WiX手册包括“ 如何:使用刻录安装.NET Framework ”。 但是,这些说明似乎不适用于在Windows 8,Windows Server 2012和更高版本的操作系统上安装.NET Framework 3.5。 看到这个StackOverflow问题 ,尤其是这个wix用户邮件列表的讨论细节。 Microsoft .NET Framework 3.5 Service Pack 1(完整软件包)安装程序将无法运行,因为您需要使用部署映像服务和pipe理(disM.exe)或其他一些技术来将请求的框架作为Windowsfunction启用。 build议的命令行如下,假定Windows安装在默认位置:
C:Windowssystem32dism.exe /online /norestart /enable-feature /featurename:netfx3
有没有一个干净的方法来确保.NET Framework 3.5将被安装在Windows 8和Windows Server 2012上的WiX? 在安装链中包含这样一个步骤是否有很好的方法?
文件夹更衣室在C#
静态string使用File.ReadAllText
如何查看networking连接是否改变状态?
在我的新窗口安装Image.FromStream不以相同的方式工作
解决Excel的path
这是我所能想到的最好的。 我已经添加了一个片段,可以在Windows 8和Windows server 2012之前为操作系统安装.NET Framework 3.5.请注意,这需要NetFxExtension对NETFRAMEWORK35_SP_LEVEL定义的引用。
<?xml version="1.0" encoding="UTF-8"?> <Wix xmlns="http://schemas.microsoft.com/wix/2006/wi" xmlns:util="http://schemas.microsoft.com/wix/UtilExtension" xmlns:netfx="http://schemas.microsoft.com/wix/NetFxExtension"> <Fragment> <util:RegistrySearchRef Id="NETFRAMEWORK35_SP_LEVEL"/> <PackageGroup Id="NetFx35Redist"> <ExePackage SourceFile="{a path on my network}MicrosoftDotNetFx3.5dotnetfx35.exe" displayName="Microsoft .NET Framework 3.5 Full" InstallCondition="VersionNT < v6.1" InstallCommand="/q /norestart" RepairCommand="/q /norestart /f" UninstallCommand="/q /norestart /uninstall" PerMachine="yes" DetectCondition="NETFRAMEWORK35_SP_LEVEL >= 1" Id="dotnetfx35.exe" Vital="yes" Permanent="yes" Protocol="none" Compressed="yes" Name="redistdotnetfx35.exe"> <!-- Exit codes 0 = Successful installation. 3010 = Successful installation; however,a system reboot is required. --> <ExitCode Value="0" Behavior="success" /> <ExitCode Value="3010" Behavior="forceReboot" /> <ExitCode Behavior="error"/> </ExePackage> </PackageGroup> </Fragment> </Wix>
在我的托管引导程序代码中,我在应用阶段开始时处理Windows 8 / Windows server 2012:
model.Bootstrapper.ApplyBegin += this.ApplyBegin; ... private void ApplyBegin(object sender,ApplyBeginEventArgs e) { this.EnsureNetFramework35(); }
调用dism.exe来启用.NET Framework 3.5的方法如下所示。 一些类似Progressviewmodel的代码引用类不会在每个托管引导程序实现中,但是我希望这可以为实现自己的版本提供一个有用的起点。
/// <summary> /// Make sure we have the .NET Framework 3.5 when we're on Windows 8,Windows server 2012,or later. /// </summary> private void EnsureNetFramework35() { // Don't worry if we're on an older OS. We don't need disM.exe in that case. if (Environment.Osversion.Version < new Version(6,1) && this.root.Model.Engine.NumericVariables.Contains("NETFRAMEWORK35_SP_LEVEL")) { return; } // Don't worry if .NET Framework 3.5 is already installed. if (this.root.Model.Engine.NumericVariables.Contains("NETFRAMEWORK35_SP_LEVEL") && this.root.Model.Engine.NumericVariables["NETFRAMEWORK35_SP_LEVEL"] >= 1) { return; } // Enable .NET Framework 3.5. this.root.Model.Engine.Log(LogLevel.Standard,"Enabling .NET Framework 3.5."); this.root.Progressviewmodel.Message = "Enabling .NET Framework 3.5."; // Get the path to disM.exe. string windowsPath = Environment.GetFolderPath(Environment.SpecialFolder.Windows); string systemPath = Path.Combine(windowsPath,"System32"); if (Environment.Is64BitOperatingSystem && !Environment.Is64BitProcess) { // For 32-bit processes on 64-bit systems,%windir%system32 folder // can only be accessed by specifying %windir%sysnative folder. systemPath = Path.Combine(windowsPath,"SysNative"); } string dismPath = Path.Combine(systemPath,@"dism.exe"); string arguments = "/online /enable-feature:NetFx3 /quiet /norestart"; if (!File.Exists(dismPath)) { this.root.Model.Engine.Log(LogLevel.Error,"Could not find file: " + dismPath); return; } this.root.Model.Engine.Log(LogLevel.Standard,dismPath + " " + arguments); this.root.Progressviewmodel.DetailMessage = dismPath + " " + arguments; Process process = new Process(); process.StartInfo.FileName = dismPath; process.StartInfo.Arguments = arguments; process.StartInfo.UseShellExecute = false; process.StartInfo.CreateNowindow = true; process.StartInfo.RedirectStandardOutput = true; process.StartInfo.RedirectStandardError = true; process.Start(); process.WaitForExit(); // Check to see if we encountered any errors. if (process.ExitCode == 0) { this.root.Model.Engine.Log(LogLevel.Standard,".NET Framework 3.5 enabled."); this.root.Progressviewmodel.Message = ".NET Framework 3.5 enabled."; this.root.Progressviewmodel.DetailMessage = string.Empty; } else { this.root.Model.Engine.Log(LogLevel.Error,".NET Framework 3.5 Could not be enabled. Exit code: " + process.ExitCode); this.root.Progressviewmodel.Message = ".NET Framework 3.5 Could not be enabled."; this.root.Progressviewmodel.DetailMessage = string.Empty; } }
这个如何使用wix bootsrapper安装网点http://wixtoolset.org/documentation/manual/v3/howtos/redistributables_and_install_checks/install_dotnet.html
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。