WiX自定义引导程序应用程序和.NET 4.5 [英] WiX Custom Bootstrapper Application and .NET 4.5

查看:58
本文介绍了WiX自定义引导程序应用程序和.NET 4.5的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我很难获得以.NET 4.5为目标的WiX自定义引导程序应用程序.

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

我的Bundle.wxs中有以下一行.

I have the following line in my Bundle.wxs.

<PackageGroupRef Id="NetFx45Web" />

我的BootstrapperCore.config如下.

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>

还有以下内容.

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

还有以下内容.

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

还有以下内容.

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

还有以下内容.

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

无论我尝试了什么,当我在未安装.NET 4.5的系统上运行安装程序包时,系统都会提示我安装.NET 4.5.一旦按下同意并安装"按钮,安装程序包就会崩溃.当我尝试再次运行安装程序包时,它会在显示按钮之前挂起.即使我重新启动,它也会挂起.我需要先从系统映像还原系统,然后才能再次运行.

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?

我正在使用WiX 3.10.

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.

这是关于堆栈溢出的另一个问题,必备的引导程序应用程序无法安装.NET 4.5 .该问题的答案之一表明,答案是在BootstrapperCore.config文件的supportedRuntime元素中设置sku值.但是,我已经做到了.发生了其他事情.

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.

推荐答案

我正在发布我自己问题的答案,希望这将使遇到类似问题的其他人受益.

I am posting an answer to my own question in the hopes that it will benefit others who encounter similar problems.

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

It turns out that the problem was not in the contents of my BootstrapperCore.config file, but in the name of my BootstrapperCore.config file. That is, the final contents of my BootstrapperCore.config file turned out to be exactly what I indicated in my question, which is as follows.

<?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.

I was on the wrong track when I tried multiple variations involving the use of the supportedFramework element. The problem turned out to have nothing to do with that. Instead, the problem was that I followed the example of the WixBA and TestBA applications that are part of WiX, which is to name the BootstrapperCore.config file after the pattern ${ProjectName}.BootstrapperCore.config. Since my project is named FSCustomBA, my BootstrapperCore.config file was named FSCustomBA.BootstrapperCore.config.

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

This is fine. It can be made to work. However, what I did not realize is that the file must be named BootstrapperCore.config in the context of the .ba directory that is created when the setup package is run. Since I was not aware of this, I included the file in my bundle as follows.

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

这将不起作用.以下将会.

This will not work. The following will.

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

请注意在Payload元素中使用Name属性.这就是说要在.ba目录中将文件BootstrapperCore.config命名.

Note the use of the Name attribute in the Payload element. This says to name the file BootstrapperCore.config in the .ba directory.

解决该问题后,我接下来遇到以下错误:"0x80131040:所定位的程序集的清单定义与程序集引用不匹配.在日志文件中,这被记录为无法加载Managed Bootstrapper应用程序.

After I resolved that problem, I next encountered the following error: "0x80131040 : The located assembly's manifest definition does not match the assembly reference." In the log file, this was recorded as an inability to loaded the Managed Bootstrapper Application.

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

In order to resolve this issue, I simply set the SuppressSignatureVerification attribute to yes for the Payload element associated with my Custom BA. For example, the Payload element I am using is as follows.

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

我认为这仅是必要的,因为我使用的是代码签名证书.

I think this is only necessary due to the code signing certificate I am using.

我的雇主将VeriSign的正式代码签名证书用于所有正式版本.但是,即使对于大多数开发人员,此证书的详细信息也保密.开发人员会在日常工作中使用自签名证书.这适用于大多数情况,但显然不适用.

My employer uses an official code signing certificate from VeriSign for all official builds. However, the details of this certificate are kept secret even from most of the developers. Developers instead use a self-signed certificate for their day to day work. This works for most things, but apparently not for this.

现在我已经解决了这些问题,我的自定义Bootstrapper应用程序正在加载,并且除一个小错误外,均按预期工作.

Now that I have resolved these issues, my Custom Bootstrapper Application is loading and, with the exception of one minor bug, working as expected.

我希望通过记录我的发现,可以避免别人为解决这个问题而不得不经历的头痛.

I hope that by documenting my findings, I will save others the headaches I had to go through to solve this problem.

这篇关于WiX自定义引导程序应用程序和.NET 4.5的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆