【问题标题】:How can I add the installation of .NET 3.5 to Installer on Windows 2008 Server R2如何将 .NET 3.5 的安装添加到 Windows 2008 Server R2 上的安装程序
【发布时间】:2010-10-07 06:25:50
【问题描述】:
我有一个自制的引导程序(称为 SetUp.exe),它检查目标计算机上是否安装了 .NET 3.5,如果没有,则通过运行 dotnetfx35.exe 启动安装。美好的。这适用于我需要的所有情况,Windows 2008 Server R2 除外。在此操作系统上,.NET 安装程序不会安装/启用 .NET 3.5。相反,它会弹出一个对话框,指示必须手动启用它。我更喜欢在我的引导程序 exe 中或从基于 WiX 的主 MSI 中自动执行此操作。
【问题讨论】:
标签:
.net-3.5
wix
installation
windows-server-2008-r2
wix3.5
【解决方案1】:
Windows Server 2008 R2 更改了 .NET Framework 安装 - 您不能简单地运行 dotnetfx35.exe(如您尝试的那样),而是需要启用服务器功能。
通常您会通过服务器管理器 > 添加功能 > .NET Framework 3.5.1 功能添加服务器角色,但您说您需要通过 WiX 安装来安装它。
我知道的唯一方法是使用 PowerShell。在 PowerShell(以管理员身份启动!)中,您需要运行以下命令:
Import-Module ServerManager
Add-WindowsFeature as-net-framework
这当然可以通过调用 powershell.exe 来编写脚本,如下所示:
powershell.exe -ImportSystemModules Add-WindowsFeature net-framework
ImportSystemModules 您需要能够调用Add-WindowsFeature。如果你想 top 保持 powershell.exe 处于打开状态以查看结果(我猜不是在部署情况下),只需添加一个-noexit 参数即可。
Microsoft SQL Server 博客上其实有一篇关于How to install/enable .Net 3.5 SP1 on Windows Server 2008 R2 for SQL Server 2008 and SQL Server 2008 R2的文章