在setup factory 的安装目录下的Dependencies中新建目录dotnet20/并放入dotnetfx2.0.exe;

Dependencies目录中再加xml文件dotnet20.xml
xml代码如下:

<DependencyTemplate>
<Dependency>
<Name> .NET Framework 2.0</Name>
<RuntimeTempFolder>dotnet20</RuntimeTempFolder>
<RevisionDate>Friday, April 1, 2011</RevisionDate>
<Description>Installs the Microsoft .NET 2.0 Framework SP2 onto the user's system. Includes the .NET installer in the setup executable.
 
Applications and controls written for the .NET Framework version 2.0 require the .NET Framework Redistributable Package version 2.0 to be installed on the computer where the application or control runs. The .NET Framework redistributable package is available as a stand-alone executable file, dotnetfx3.exe. When this dependency module is included in your setup, it detects and installs the .NET Framework redistributable.
 
This dependency module requires that you supply a copy of both Microsoft .NET Framework redistributable files (NetFx20SP2_x86.exe and NetFx20SP2_x64.exe). The .NET installation files can be downloaded from the following URL:
 
http://www.microsoft.com/downloads/en/details.aspx?FamilyID=5B2C0358-915B-4EB5-9B1D-10E506DA9D0F
 
</Description>
<DetectScript>function isDotNet_Installed()
 --Check to see if the registry key exists
 local DotNet_Registry = Registry.DoesKeyExist(HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\NET Framework Setup\\NDP\\v2.0.50727");
 if (DotNet_Registry == false) then
 -- The registry key does not exist
 -- Run the .NET Installation script
 -- Output to the log file that .NET could not be found, so it will be installed.
 SetupData.WriteToLogFile("Info\t.NET 2.0 Module: No version of .NET 2.0 was found. .NET 2.0 will be installed.\r\n", true);
 return false;
 else
 -- The key does exist
 -- Get the .NET install success value from the registry
 local DotNet_Install_Success = Registry.GetValue(HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\NET Framework Setup\\NDP\\v2.0.50727", "Install", true);
 
 if (DotNet_Install_Success == "1") then
 -- Check the version key.
 local DotNet_Install_Version = Registry.GetValue(HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\NET Framework Setup\\NDP\\v2.0.50727", "Version", true);
 
 -- Compare the returned value against the needed value
 Compare = String.CompareFileVersions(DotNet_Install_Version, "2.2.30729");
 
 if (Compare == 0 or Compare == 1) then
 -- .NET version 2.0 SP2 is installed already
 SetupData.WriteToLogFile("Info\t.NET 2.0 Module: .NET version 2.0 SP2 is installed already\r\n", true);
 return true;
 end
 else
 -- The success value wasn't found
 -- Run the .NET Installation script
 -- Output to the log file that .NET could not be found, so it will be installed.
 SetupData.WriteToLogFile("Info\t.NET 2.0 Module: No version of .NET 2.0 was found. .NET 2.0 will be installed.\r\n", true);
 return false;
 end
 end
 return true;
end</DetectScript>
<DetectFunction>isDotNet_Installed</DetectFunction>
<InstallScript>

-- Check to see if this is a valid operating system for .NET 3.0
 function isValidDotNet2OS()
 SetupData.WriteToLogFile("Info\t.NET 2.0 Module: Entering compatible OS detection.\r\n",true);
 
 local tblOSInfo = System.GetOSVersionInfo();
 local strOSName = System.GetOSName();
 
 -- Check Windows XP
 if (tblOSInfo.MajorVersion == "5") and (tblOSInfo.MinorVersion == "1") then
 return true;
 end
 
 -- Check Windows Server 2003
 if (tblOSInfo.MajorVersion == "5") and (tblOSInfo.MinorVersion == "2") then
 return true;
 end
 
 -- this installer is not supported on other platforms
 return false;
 end
 
 
 if (not isDotNet_Installed()) then
 -- Variables used in the installation actions:
 local strMessage = [[Setup has detected that your Microsoft .NET run-time files are out of date.
                                                            
 local strDialogTitle = "Technology Required";
 local bShowUserPrompt = true; -- Whether to prompt the user for confirmation before running the .NET installer.
 local bRunInstallFile = true; -- The default of whether or not to run the setup
 local bRequirementFail = false;
 local tbRequirementFailStrings = {};
 
 local strAbortQuestion = [[
 
 Due to this requirement failure, it is recommended that you abort the install.
 
 Click OK to abort the setup, or Cancel to continue with the application install.]];
 local strRequirementString = [[.NET 2.0 cannot be installed due to the following requirements:
 
 ]];
 local strRuntimeSupportFolder = SessionVar.Expand("%TempLaunchFolder%\\dotnet20");
 local b64BitOs = System.Is64BitOS();
 local strExtractInstallerToPath = "";
 if (b64BitOs) then
 --strExtractInstallerToPath = strRuntimeSupportFolder.."\\NetFx20SP2_x64.exe";
 strExtractInstallerToPath = strRuntimeSupportFolder.."\\dotnetfx2.0.exe";
 else
 strExtractInstallerToPath = strRuntimeSupportFolder.."\\dotnetfx2.0.exe";
 --strExtractInstallerToPath = strRuntimeSupportFolder.."\\NetFx20SP2_x86.exe";
 end
 local strMessageFail = "";
 local _NeedsReboot = false;
 local strCmdArgs = "";
 local bSilentMode = true; -- Whether to send the /q switch to the .NET 2.0 installer.
 local bVital = true; -- Whether the .NET 2.0 installation is vital.
 
 -- Output to the log that the .NET installation script has started.
 SetupData.WriteToLogFile("Success\t.NET 2.0 Module: Installation script started.\r\n", true);
 
 ------------------------------------------------------------------------------------------------------------
 ---- Requires Internet Explorer 6.0 greater
 ------------------------------------------------------------------------------------------------------------
 
 -- Read the version of Internet Explorer (if installed).
 strIEVersion = Registry.GetValue(HKEY_LOCAL_MACHINE, "Software\\Microsoft\\Internet Explorer", "Version", false);
 
 -- If Internet Explorer Version is less than 6.00.2800.1106 , or cannot be found,
 -- set the failure variable and failure string table.
 if ((String.CompareFileVersions(strIEVersion, "6.00")== -1) or (strIEVersion == "")) then
 bRequirementFail = true;
 strTemp = "- .NET 2.0 requires Internet Explorer version 6.0 or greater.";
 Table.Insert(tbRequirementFailStrings, Table.Count(tbRequirementFailStrings) + 1, strTemp);
 end
 
 ------------------------------------------------------------------------------------------------------------
 ---- Requires Admin permissions ----
 ------------------------------------------------------------------------------------------------------------
 
 -- Check if the user is logged in with administrative permissions.
 -- If the user doesn't have admin permissions, set the failure variable
 -- and failure string table.
 tbUserInfo = System.GetUserInfo();
 if (tbUserInfo ~= nil) then
 if (not tbUserInfo.IsAdmin) then
 bRequirementFail = true;
 strTemp = "- You do not have the required administrative permissions to install .NET 2.0.";
 Table.Insert(tbRequirementFailStrings, Table.Count(tbRequirementFailStrings) + 1, strTemp);
 end
 end
 
 ------------------------------------------------------------------------------------------------------------
 ---- Requires MSI 3.1 ----
 ------------------------------------------------------------------------------------------------------------
 -- Get the operating system name.
 local strOSName = System.GetOSName();
 
 local strMSIVersion = MSI.GetMSIVersion();
 
 
 -- need MSI 3.1
 if (String.CompareFileVersions(strMSIVersion,"3.1.4000") == -1) or (not strMSIVersion) then
 -- MSI 3.1 is not installed
 bRequirementFail = true;
 strTemp = "- The .NET 2.0 runtime module requires Windows Installer 3.1. Please install this technology then run the setup again.";
 Table.Insert(tbRequirementFailStrings, Table.Count(tbRequirementFailStrings) + 1, strTemp);
 end
 
 
 ------------------------------------------------------------------------------------------------------------
 ---- Operating System Check
 -- Windows Server 2003
 -- Windows XP
 ------------------------------------------------------------------------------------------------------------
 
 
 -- Check if OS is Windows XP or Windows Server 2003
 if (not isValidDotNet2OS()) then
 bRequirementFail = true;
 --.NET 2.0 isn't supported on the OS that was detected.
 strTemp = "- .NET 2.0 cannot be installed on this operating system. Requires Windows XP, or Windows Server 2003.";
 Table.Insert(tbRequirementFailStrings, Table.Count(tbRequirementFailStrings) + 1, strTemp);
 end
 
 
 -- Check if the dialog should be displayed asking whether or not they want to install the module.
 if(bShowUserPrompt)then
 local nDialogResult = Dialog.Message(strDialogTitle,strMessage,MB_OKCANCEL,MB_ICONEXCLAMATION);
 if(nDialogResult == IDOK)then
 -- The user chose to install the module.
 bRunInstallFile = true;
 else
 -- The user chose not to install the module.
 bRunInstallFile = false;
 end
 end
 
 if (not bRequirementFail) then
 -- Check if the user wants to install the runtime.
 if(bRunInstallFile)then
 -- The following are command line options that can be used when launching the install file Dotnetfx3.exe.
 -- /q - Suppresses all UI. An .INI file cannot be specified with this option.
 -- /quiet - Same as /q.
 -- /qb - Displays minimal UI, showing only progress.
 -- /passive - Same as /qb.
 -- /uninstall - Uninstalls product.
 -- /remove - Same as /uninstall.
 -- /f - Repairs all .NET Framework 3.0 components that are installed.
 -- /nopatch - Specifies that patches are not applied and bypasses patch checking.
 -- /norollback - Specifies that setup is not rolled back if a setup component fails.
 -- /norestart - Specifies that the installer does not restart the computer after installation completes. The
 --redistributable installer returns ERROR_SUCCESS_REBOOT_REQUIRED (3010) if a reboot is required.
 --/? - Displays this list of options.
 
 
 if (bSilentMode) then
 -- Passing quite mode, and no restart.
 strCmdArgs = strCmdArgs.."/qb /norestart ";
 else
 -- Passing no restart.
 strCmdArgs = strCmdArgs.."/norestart ";
 end
 strCmdArgs = "/R:N";
 -- Output to the log that the .NET installation is being launched.
 SetupData.WriteToLogFile("Info\t.NET 2.0 Module: .NET 2.0 installation file "..strExtractInstallerToPath.." is being launched.\r\n");
 local nResult = File.Run(strExtractInstallerToPath, strCmdArgs, "", SW_SHOWNORMAL, true);
 if (nResult == 3010) then
 -- .NET install indicated that it needs reboot to be complete
 -- Set MSI Factory's reboot variable so that the reboot is just
 -- performed at the end of the install.
 _NeedsReboot = true;
 elseif (nResult == 1602) then
 -- The user canceled the setup program.
 strMessageFail = [[You have cancelled the installation for .NET 2.0. It is not recommended that you continue with the setup.
 
 Click OK to abort the setup, or Cancel to continue with the application install.]];
 elseif (nResult == 1603) then
 -- A fatal error occurred during installation.
 strMessageFail = [[A fatal error occurred during installation of the .NET 2.0 runtime. It is not recommended that you continue with the setup.
 
 Click OK to abort the setup, or Cancel to continue with the application install.]];
 elseif (nResult == 1605) then
 -- This action is only valid for products that are currently installed.
 strMessageFail = [[Error during installation of the .NET 2.0 runtime. This action is valid only for products that are currently installed. It is not recommended that you continue with the setup.
 
 Click OK to abort the setup, or Cancel to continue with the application install.]];
 elseif (nResult == 1636) then
 -- The patch package could not be opened or the patch was not applicable to the .NET Framework 3.0.
 strMessageFail = [[The patch package could not be opened or the patch was not applicable to the .NET Framework 2.0. It is not recommended that you continue with the setup.
 
 Click OK to abort the setup, or Cancel to continue with the application install.]];
 elseif (nResult == 1639) then
 -- Invalid command line argument.
 strMessageFail = [[An invalid command line argument was passed to the .NET 2.0 installation. It is not recommended that you continue with the setup.
 
 Click OK to abort the setup, or Cancel to continue with the application install.]];
 elseif (nResult == 1643) then
 -- The patch package is not permitted by system policy.
 strMessageFail = [[The .NET 2.0 patch package is not permitted by system policy. It is not recommended that you continue with the setup.
 
 Click OK to abort the setup, or Cancel to continue with the application install.]];
 elseif (nResult == 0) then
 -- The .NET setup was successful, so do nothing.
 else
 -- The .NET setup program was not completed successfully.
 strMessageFail = [[An unknown error occurred during the installation of the .NET 2.0 runtime. It is not recommended that you continue with the setup.
 
 Click OK to abort the setup, or Cancel to continue with the application install.]];
 end
 
 -- Check to see if an error message was generated.
 if (strMessageFail ~= "") then
 -- Display the error notification dialog.
 
 -- Output to the log .NET error message.
 SetupData.WriteToLogFile("Error\t.NET 2.0 Module: Dialog error shown- "..strMessageFail..".\r\n");
 
 if (bShowUserPrompt) then
 nDialogResult = Dialog.Message(".NET 2.0 Installation" ,strMessageFail,MB_OKCANCEL,MB_ICONEXCLAMATION);
 if (nDialogResult == IDOK) then
 bAbortInstall = true;
 end
 end
 end
 
 -- Delete the run time installer file and remove the temp folder
 File.Delete(strExtractInstallerToPath);
 --Folder.Delete(strRuntimeSupportFolder);
 
 -- If the user chose to abort the install after the failure of .NET install, exit the setup.
 if (bAbortInstall) then
 -- Output to the log that the user chose to abort the setup after .NET failure.
 SetupData.WriteToLogFile("Error\t.NET 2.0 Module: User chose to abort setup after .NET failure. Exiting setup.\r\n");
 Application.Exit(EXIT_REASON_USER_ABORTED);
 end
 
 
 
 else
 -- The user chose not to install the runtime so delete the run time installer file,
 -- remove the temp folder and then exit the setup.
 
 -- Output to the log that the user chose to abort the setup.
 SetupData.WriteToLogFile("Error\t.NET 2.0 Module: User chose to abort setup. Exiting setup.\r\n");
 
 File.Delete(strExtractInstallerToPath);
 --Folder.Delete(strRuntimeSupportFolder);
 if bVital then
 Application.Exit(EXIT_REASON_USER_ABORTED);
 else
 Application.ExitScript();
 end
 end
 else
 -- A requirement failed
 
 -- If the user didn't cancel...
 if (bRunInstallFile) then
 -- One or more of the requirements failed. Notify the user and ask if they wish
 -- to abort the installation.
 strFullErrorString = Table.Concat(tbRequirementFailStrings, "\r\n", 1, TABLE_ALL);
 nDialogResult = Dialog.Message("Notice" , strRequirementString..strFullErrorString..strAbortQuestion, MB_OKCANCEL, MB_ICONINFORMATION, MB_DEFBUTTON1);
 
 -- Output the requirement failure string to the log.
 SetupData.WriteToLogFile("Error\t.NET 2.0 Module: Requirement failure dialog: "..strFullErrorString.."\r\n");
 
 -- Delete the runtime installer file and remove the temp folder
 File.Delete(strExtractInstallerToPath);
 
 -- The user chose to abort the install due to the requirement failure of .NET.
 if (nDialogResult == IDOK) then
 
 -- Output to the log that the user chose to abort the install due to requirement failure.
 SetupData.WriteToLogFile("Error\t.NET 2.0 Module: User aborted setup due to requirement failure. Exiting setup.\r\n");
 
 -- Abort the install.
 Application.Exit(EXIT_REASON_USER_ABORTED);
 end
 else
 -- The user chose not to install the runtime so delete the run time installer file,
 -- remove the temp folder and then exit the setup.
 
 -- Output to the log that the user chose to abort the setup.
 SetupData.WriteToLogFile("Error\t.NET 2.0 Module: User chose to abort setup. Exiting setup.\r\n");
 
 File.Delete(strExtractInstallerToPath);
 
 if bVital then
 Application.Exit(EXIT_REASON_USER_ABORTED);
 else
 Application.ExitScript();
 end
 
 end
 end
 
 -- If a reboot was needed by .NET, notify the user that they must reboot
 -- before continuing with the install
 
 -- NOTE: If you would always like to force the user to reboot, comment out the "if (_NeedsReboot) then" condition below.
 
 local strRebootMessage = [[A reboot is required to continue with the installation. After rebooting, re-run the installation.
 
 Click OK to reboot now, or Cancel to reboot later.]];
 if (_NeedsReboot) then
 nDialogResult = Dialog.Message("Notice", strRebootMessage, MB_OKCANCEL, MB_ICONINFORMATION, MB_DEFBUTTON1);
 
 -- Output to the log that a reboot is required by the .NET setup.
 SetupData.WriteToLogFile("Info\t.NET 2.0 Module: .NET 2.0 detected that a reboot is required.\r\n");
 -- Check if the uer wanted to reboot now.
 if (nDialogResult == IDOK) then
 
 -- NOTE: If you would like the install to relaunch itself after the reboot,
 -- uncomment the following block of code.
 -- Re-run the installation after the reboot.
 
 File.RunOnReboot(_SourceFilename, "");
 
 -- Output to the log that a reboot will be performed.
 SetupData.WriteToLogFile("Info\t.NET 2.0 Module: A reboot will be performed.\r\n");
 -- Reboot the user's system.
 System.Reboot();
 Application.Exit(0);
 else
 -- Output to the log that the user chose to reboot later and abort the setup.
 SetupData.WriteToLogFile("Info\t.NET 2.0 Module: User chose to reboot later. Exiting setup.\r\n");
 -- Abort the install.
 Application.Exit(EXIT_REASON_USER_ABORTED);
 end
 end
 -- Output to the log that the installation script has finished.
 SetupData.WriteToLogFile("Success\t.NET 2.0 Module: Installation script finished.\r\n");
 end
</InstallScript>
<SupportFiles>
<File>#SUFDIR#\Dependencies\dotnet20\dotnetfx2.0.exe</File>
</SupportFiles>
</Dependency>
</DependencyTemplate>


然后在 资源(resource)-从属(Dependencies)中添加.NET Framework 2.0就行了。

在Actions—> on startup下面添加 下面代码

 result = Registry.DoesKeyExist(HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\.NETFramework\\policy\\v2.0");
if (result == false) then
 result = File.Run(SessionVar.Expand("%TempLaunchFolder%\\dotnetfx2.0.exe"), "", "", SW_SHOWNORMAL, true);
end
 

Setup Factory 打包.netframework 2.0的更多相关文章

  1. 本人亲测-Setup Factory打包教程(整理并优化)

    Setup Factory 9 总结 一:安装完毕立刻启动 result = Shell.Execute(SessionVar.Expand("%AppFolder%\\消息助手.exe&q ...

  2. 使用Setup factory打包WPF

    软件环境 Win10 .NET452 WPF Setup Factory 工具直接百度下啦,关键词:Setup Factory 95 With Sn 打包过程主要参考了以下文章: https://ww ...

  3. Setup Factory打包winform程序

    摘要 Setup Factory是一款软件安装工具.Setup Factory支持创建一个安装文件或一个单间的setup.exe文件,生成文件可以运行于任意版本的windows中. 步骤 1.安装Se ...

  4. setup factory 打包VB 工程

    setup factory 使用起来很简单你可以如下:1.你把你刚编译出来的exe和相关的资源文件复制到某一空目录下.把exe文件添加到setup factory里之后,在列表里右键,属性里面可以设置 ...

  5. Setup Factory Error3014

    在用Setup Factory打包软件的时候出现Error3014 一般都是由于软件冲突引起的 我的问题是由于杀毒软件 ,在打包的时候关闭杀毒软件 就能成功打包了.

  6. 【原创】VB6.0应用程序安装包的生成(Setup Factory 9.0制作安装包的方法)

    VB6.0应用程序安装包的生成,利用其自带的打包工具生成的安装程序很简陋,一点不美观:如果想让自己的应用程序安装的时候显得高大上一点,本教程提供使用Setup Factory 9.0制作安装包的方法. ...

  7. Setup Factory 9 简单打包

    由于项目资源太大,使用VS自带打包工具无法实现需求,所以Setup Factory 9进行打包生成多个文件的方案,下面记录使用方法: 一:这里点击下载:下载,提取码:tt7a 二:下载完安装需要注册码 ...

  8. Setup Factory 9 打包安装程序过程中提示安装.net4.5、并启用md5加密算法

    1.在Before Installing选项卡中选择Ready to Install,点击Edit进入编辑窗口,切到最后一个选项卡Actions,把判断内容复制进去 -- These actions ...

  9. Import-Module ServerManager Import-Module : 未能加载指定的模块“ServerManager”,因为在任何模块目录中都没有找到有效模块文件...(通过Setup Factory调用PowerShell的脚本)

    操作系统: Windows server 2008 R2(64位) C:\Windows\System32\WindowsPowerShell\v1.0\Modules 下有ServerManager ...

随机推荐

  1. ITERATOR(迭代器)设计模式

    1 意图:提供一种方法顺序访问一个聚合对象中各个元素,而又不暴露该对象的内部表示. 2 别名(Cursor) 3 动机:队列表的访问和遍历从列表对象中分离出来放入一个迭代器对象中.   多态迭代   ...

  2. zookeeper错误

    ZooKeeper JMX enabled by defaultUsing config: /data4/hadoop/zookeeper-3.4.8/bin/../conf/zoo.cfgError ...

  3. [转]Android_气泡效果

    最近在看以前在eoe上收藏的一些源代码,准备将这些代码加上一些自己的注释,然后贴出来,方便自己日后查阅,和刚入门的人来学习. 今天先看一个气泡窗口,先看一下效果图和目录结构,然后再上代码 通过第一幅图 ...

  4. 项目解析- JspLibrary - part1

    http://rosspc:8080/JspLibrary/ 1. logon界面解析: JS 验证用户名.密码为空 <form name="form1" method=&q ...

  5. WANL标准组织介绍-02

    无线电管理委员会 FCC ETSI IEEE Wi-Fi IETF WAPI 国家无线电管理委员会认证 国家无线电管理委员会认证(State Radio Regulatory Commission o ...

  6. nodeschool.io 7

    ~~ HTTP CLIENT ~~ Write a program that performs an HTTP GET request to a URL provided toyou as the f ...

  7. struts2 拦截器的注册在strut.xml中

    根据需要:需要在struts.xml中注册拦截器为以下内容  根据自己的业务需要更改参数 <!DOCTYPE struts PUBLIC "-//Apache Software Fou ...

  8. WPF:xmal 静动态资源

    <StackPanel.Resources> <SolidColorBrush x:Key="myBrush" Color="Teal"/&g ...

  9. ARM中的总线

    ARM中的总线用于不同部件之间的通信.有两种不同类型的设备连接到总线:ARM处理器,它是总线的主设备,拥有对总线的仲裁权,可以通过同一总线主动发起数据传输请求:外围器件,是总线的从设备,在总线上是被动 ...

  10. mvc伪静态<三> IIS配置

    上一篇已经已经讲述了mvc伪静态的代码实现. 下面以IIS 7.5为例演示一下IIS如何配置才能在服务器显示.html的伪静态 一.进入IIS,选择处理程序映射 二添加脚本映射 三根据你的处理程序的版 ...