4

I've been using Inno Setup to check for and install the .NET 2.0 framework for one of my applications. It's worked pretty faultessly by checking for a Registry Key and simply downloading the .NET installer and installing prior to installing my application.

From what I understand this isn't working in Windows 8. Windows 8 bundles .NET 2.0 in the .NET 3.5 package which is enabled via the W8 "Install Windows Features" applet thingamy. Rather than downloading the .NET 2.0 installer I'd rather have Inno trigger the installation of the Windows feature applet to enable .NET 3.5 support. Any ideas how this could be done?

4

2 回答 2

5

解决方案

感谢@Miral 的建议。

添加了额外的检查以确定 Windows 8 是否正在运行:

GetWindowsVersionEx(Version);
if (Version.Major=6) and (Version.Minor=2) then
  begin
    Windows8:=true;
  end;

然后将此代码包含在 NextButtonClick 事件中并检查 CurPage 是否为 wpReady:

 if dotNetNeeded and Windows8 then
    begin
      Exec('Dism', ' /online /enable-feature /featurename:NetFx3 /All /NoRestart', '', SW_SHOW, ewWaitUntilTerminated, ResultCode)
    end;
于 2013-06-20T01:50:54.127 回答
5

根据 Microsoft的说法,尝试运行可再发行组件应该会自动触发 Windows 8 上该功能的内部激活。因此,如果您将 dotnetfx35 可再发行组件与您的安装程序捆绑在一起,那么您不需要更改任何内容。

但是,如果您是按需下载可再发行组件,那么检测 Windows 8 或更高版本并通过以下命令行触发安装会更有效:

Dism /online /enable-feature /featurename:NetFx3 /All

在 Inno 中,您应该ExecPrepareToInstall事件函数中执行此操作。

于 2013-06-19T21:03:39.523 回答