在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. Django中如何配置Database缓存?

    BACKEND: django.core.cache.backends.db.DatabaseCache LOCATION: 数据库表名 示例: CACHES = { 'default': { 'BA ...

  2. NDK与JNI

    什么是NDK(android native develop kits) :android 本地开发工具集,可以把c/c++编译成一个linux下可以执行的二进制文件 java代码里面就可以通过jni ...

  3. matlab灰度变彩色+白平衡算法实现

    % matlab彩色图像分离通道并合并成处理后的彩色图像(彩色变灰度再变彩色) % 白平衡算法(灰度世界法)消除RGB受光照影响 clear all; close all; %读入原始图像 srcIm ...

  4. java 导入包(误区)

    java的导入包语句的作用仅仅是简化书写,很多时候我们都误以为是将一个类导入到内存中. 如果是这样,那么运行的效率会很慢.

  5. 【OpenCV入门指南】第一篇 安装OpenCV

    http://blog.csdn.net/morewindows/article/details/8225783/ win10下vs2015配置Opencv3.1.0过程详解(转) http://ww ...

  6. 屏幕输出VS文件输出

     问题1:我们在编写程序时经常需要数一些数据到屏幕,来查看我们的结果是否正确,虽然直接输出到屏幕,查看起来呢很方便,但当数据量很大时,需要耗费大量的时间.于是我们想到能不能通过输出到文件来减少时间 ...

  7. 【数位统计】之【spoj1433 KPSUM】

    [spoj1433]KPSUM 来源 高逸涵<数位计数问题解法研究> 由于自己的数位计数类的问题实在太差了,所以把例2用markdown抄写并补充了一遍. 题意 将写在纸上,然后在相邻的数 ...

  8. angular 模板 小例子

    参考网站:https://docs.angularjs.org/tutorial/step_09 先看下目录结构 新建个空文件夹, 输入命令: express --view ejs cnpm inst ...

  9. django 2

    创建一个管理员用户 首先,我们需要创建一个用户可以登录到管理网站. 运行 下面的命令: $ python manage.py createsuperuser 输入你想要的用户名,按回车. Userna ...

  10. listbox鼠标拖动数据和为button注册快捷键

    将listbox1中的数据用鼠标拖动至listbox2,即有左至右. 分别对应控件注册如下事件DragEnter,MouseDown,DragDrop 代码如下: //P128 DataGridVie ...