6

I am having difficulties getting a WiX Custom Bootstrapper Application that targets .NET 4.5 to work.

I have the following line in my Bundle.wxs.

<PackageGroupRef Id="NetFx45Web" />

My BootstrapperCore.config is as follows.

<configuration>
    <configSections>
        <sectionGroup name="wix.bootstrapper" type="Microsoft.Tools.WindowsInstallerXml.Bootstrapper.BootstrapperSectionGroup, BootstrapperCore">
            <section name="host" type="Microsoft.Tools.WindowsInstallerXml.Bootstrapper.HostSection, BootstrapperCore" />
        </sectionGroup>
    </configSections>
    <startup useLegacyV2RuntimeActivationPolicy="true">
        <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
    </startup>
    <wix.bootstrapper>
        <host assemblyName="FSCustomBA" />
    </wix.bootstrapper>
</configuration>

I have tried multiple variations of this.

For example, I have also tried the following.

<host assemblyName="FSCustomBA">
    <supportedFramework version="v4\Full" />
    <supportedFramework version="v4\Client" />
</host>

And the following.

<host assemblyName="FSCustomBA">
    <supportedFramework version="v4.5\Full" />
    <supportedFramework version="v4.5\Client" />
</host>

And the following.

<host assemblyName="FSCustomBA">
    <supportedFramework version="v4.5" />
</host>

And the following.

<host assemblyName="FSCustomBA">
    <supportedFramework version="v4.5\Full" />
</host>

And the following.

<host assemblyName="FSCustomBA">
    <supportedFramework version="v4.5\Client" />
</host>

No matter what I have tried, when I run my setup package on a system that does not have .NET 4.5 installed, I am prompted to install .NET 4.5. Once I press the Agree and Install button, the setup package crashes. When I attempt to run the setup package again, it hangs before it displays the buttons. It hangs even after I reboot. I need to restore my system from the system image before it will run again.

Can anyone tell me what I am doing wrong?

I am using WiX 3.10.

Thus far my only clue as to what is going on is the following line in the resulting log files.

[1A14:1778][2016-06-28T10:01:17]i000: The prerequisites were already installed. The bootstrapper application will not be reloaded to prevent an infinite loop.

This is mentioned in another question here on Stack Overflow, Prerequisite bootstrapper application fails to install .NET 4.5. One of the answers to this question suggests that the answer is to set the sku value in the supportedRuntime element of the BootstrapperCore.config file. However, I have done this. Something else is going on.

4

1 回答 1

7

我正在发布我自己问题的答案,希望它能够使遇到类似问题的其他人受益。

事实证明,问题不在于我的 BootstrapperCore.config 文件的内容,而在于我的 BootstrapperCore.config 文件的名称。也就是说,我的 BootstrapperCore.config 文件的最终内容结果正是我在我的问题中指出的,如下所示。

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
    <configSections>
        <sectionGroup name="wix.bootstrapper" type="Microsoft.Tools.WindowsInstallerXml.Bootstrapper.BootstrapperSectionGroup, BootstrapperCore">
            <section name="host" type="Microsoft.Tools.WindowsInstallerXml.Bootstrapper.HostSection, BootstrapperCore" />
        </sectionGroup>
    </configSections>
    <startup useLegacyV2RuntimeActivationPolicy="true">
        <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
    </startup>
    <wix.bootstrapper>
        <host assemblyName="FSCustomBA" />
    </wix.bootstrapper>
</configuration>

当我尝试涉及使用 supportedFramework 元素的多种变体时,我走错了路。事实证明,这个问题与此无关。相反,问题在于我遵循作为 WiX 一部分的 WixBA 和 TestBA 应用程序的示例,即在模式 ${ProjectName}.BootstrapperCore.config 之后命名 BootstrapperCore.config 文件。由于我的项目名为 FSCustomBA,因此我的 BootstrapperCore.config 文件名为 FSCustomBA.BootstrapperCore.config。

这可以。它可以工作。但是,我没有意识到该文件必须在运行安装包时创建的 .ba 目录的上下文中命名为 BootstrapperCore.config。由于我不知道这一点,因此我将文件包含在我的包中,如下所示。

<Payload SourceFile="$(var.FSCustomBA.TargetDir)FSCustomBA.BootstrapperCore.config" />

这行不通。以下将。

<Payload Name="BootstrapperCore.config"  SourceFile="$(var.FSCustomBA.TargetDir)FSCustomBA.BootstrapperCore.config" />

请注意在 Payload 元素中使用 Name 属性。这表示将 .ba 目录中的文件 BootstrapperCore.config 命名。

在我解决了这个问题之后,我接下来遇到了以下错误:“0x80131040:定位的程序集的清单定义与程序集引用不匹配。” 在日志文件中,这被记录为无法加载托管引导程序应用程序。

为了解决此问题,我只需将与我的自定义 BA 关联的 Payload 元素的 SuppressSignatureVerification 属性设置为 yes。例如,我使用的 Payload 元素如下。

<Payload SourceFile="$(var.FSCustomBA.TargetDir)FSCustomBA.dll" SuppressSignatureVerification="yes" />

我认为这只是由于我使用的代码签名证书是必要的。

我的雇主对所有官方版本都使用 VeriSign 的官方代码签名证书。但是,即使是大多数开发人员,该证书的详细信息也是保密的。相反,开发人员在日常工作中使用自签名证书。这适用于大多数事情,但显然不适用于此。

现在我已经解决了这些问题,我的自定义引导程序应用程序正在加载,除了一个小错误外,它可以按预期工作。

我希望通过记录我的发现,我将避免其他人为解决这个问题而遇到的麻烦。

于 2016-06-28T23:33:49.553 回答