首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >由WiX引导程序创建的安装程序未启动

由WiX引导程序创建的安装程序未启动
EN

Stack Overflow用户
提问于 2013-05-06 16:38:31
回答 1查看 2.2K关注 0票数 3

我尝试使用Bootstrapper创建一个安装文件,它打算首先运行.NET框架安装文件,然后运行MyApp.exe。完成项目后,我得到了最终的设置文件,但即使是双击或选择文件后按enter键也无法启动。我不知道我哪里错了。

这是program.cs文件:

代码语言:javascript
运行
复制
using Microsoft.Tools.WindowsInstallerXml.Bootstrapper;
namespace testingBoot
{
    class Program:BootstrapperApplication
    {
        static void Main(string[] args)
        {
            Console.WriteLine("This is tesing for the bootStrapper");
            Console.Read();
        }

        protected override void Run()
        {
            throw new NotImplementedException();
        }
    }
}

我的WiX安装文件在这里

代码语言:javascript
运行
复制
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
     xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">

    <Bundle UpgradeCode="46C265F4-3F60-4781-9EF6-DB889C115D55" Version="1.0.0.0">
        <BootstrapperApplicationRef Id="ManagedBootstrapperApplicationHost" >
            <Payload SourceFile="BootstrapperCore.config" />
            <Payload SourceFile="C:\Program Files (x86)\WiX Toolset v3.7\SDK\Microsoft.Deployment.WindowsInstaller.dll" />
        </BootstrapperApplicationRef>
        <Variable Name="LaunchTarget"
            Value="[ProgramFiles64Folder]Folder\Exe Name.exe"/>
        <Chain>
          <PackageGroupRef Id="Netfx4Full"/>
          <ExePackage SourceFile="$(var.PATH)\testingBoot.exe"/>
        </Chain>
    </Bundle>

    <Fragment>
        <WixVariable Id="WixMbaPrereqPackageId"
                     Value="Netfx4Full"/>
        <WixVariable Id="WixMbaPrereqLicenseUrl"
                     Value="NetfxLicense.rtf" />
        <util:RegistrySearch Root="HKLM"
                             Key="SOFTWARE\Microsoft\Net Framework Setup\NDP\v4\Full"
                             Value="Version"
                             Variable="Netfx4FullVersion" />
        <util:RegistrySearch Root="HKLM"
                             Key="SOFTWARE\Microsoft\Net Framework Setup\NDP\v4\Full"
                             Value="Version"
                             Variable="Netfx4x64FullVersion"
                             Win64="yes" />

        <PackageGroup Id="Netfx4Full">
            <ExePackage Id="Netfx4Full"
                        Cache="no"
                        Compressed="yes"
                        PerMachine="yes"
                        Permanent="yes"
                        Vital="yes"
                        Name="dotNetFx40_Full_x86_x64.exe"
                        SourceFile="dotNetFx40_Full_x86_x64.exe"
                        DetectCondition="VersionNT64" />
        </PackageGroup>
    </Fragment>

    <Fragment>
        <ComponentGroup Id="ProductComponents"
                        Directory="INSTALLFOLDER">
            <!-- TODO: Remove the comments around this Component element and the ComponentRef below in order to add resources to this installer. -->
            <!-- <Component Id="ProductComponent"> -->
                <!-- TODO: Insert files, registry keys, and other resources here. -->
            <!-- </Component> -->
        </ComponentGroup>
    </Fragment>
</Wix>

此外,我还在配置文件BootstrapperCore.config中将host下的assemblyName更改为我自己的程序集名testingBoot.exe

下面是我的BootStrapperCore.config文件的内容:

代码语言:javascript
运行
复制
<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" />
        <supportedRuntime version="v2.0.50727" />
    </startup>
    <wix.bootstrapper>
        <host assemblyName="testingBoot" >
            <supportedFramework version="v4\Full" />
        </host>
    </wix.bootstrapper>
</configuration>
EN

回答 1

Stack Overflow用户

发布于 2013-05-06 21:00:27

BootstrapperApplicationRef元素中似乎缺少您的BootstrapperApplication程序集。我还应该指出,Burn引擎直接加载您的BA程序集。它不会将其作为可执行文件启动。因此,要加载BootstrapperApplication,我认为您需要进行以下更改:

代码语言:javascript
运行
复制
<BootstrapperApplicationRef Id="ManagedBootstrapperApplicationHost" >

  <Payload SourceFile="$(var.PATH)\testingBoot.exe"/>
  <Payload SourceFile="BootstrapperCore.config" />

  <Payload SourceFile="C:\Program Files (x86)\WiX Toolset v3.7\SDK\Microsoft.Deployment.WindowsInstaller.dll" />
</BootstrapperApplicationRef>

这会将testingBoot.exe添加到BootstrapperApplication中,如果您的BoostrapperCore.config文件如下所示:

代码语言:javascript
运行
复制
<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" />
  </startup>
  <wix.bootstrapper>
    <host assemblyName="testingBoot">
        <supportedFramework version="v4\Full" />
        <supportedFramework version="v4\Client" />
    </host>
  </wix.bootstrapper>
</configuration>

然后Burn引擎将找到一个名为testingBoot的程序集并加载该程序集。同样,如上所述,testingBoot将被直接加载,Run()方法将被直接调用。将跳过Main()入口点,因为刻录引擎不会将程序集作为可执行文件运行。

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/16394968

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档