2013-05-06 109 views
2

我试图使用Bootstrapper创建安装文件,该文件旨在首先运行.NET框架安装文件,然后才运行MyApp.exe。完成该项目后,我得到了最终的安装文件,但即使在选择文件后双击或按回车键后也无法启动。我不知道我错在哪里。由WiX bootstrapper创建的安装程序未启动

这是program.cs文件:

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的安装文件是在这里

<?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下主机发生变化的AssemblyName我自己组装的名字为testingBoot.exe

这里是我的BootStrapperCore.config文件的内容:

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

回答

2

看来,你的BootstrapperApplication组件从BootstrapperApplicationRef元素缺失。我还应该注意烧伤引擎直接加载你的BA程序集。它不会将其作为可执行文件启动。因此,为了让您的BootstrapperApplication装,我想你会想做出以下变化:

<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文件看起来像:

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

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

+0

感谢您的回复。它似乎更合理,虽然,我试过这与我的项目,但仍然有同样的问题,安装文件无法启动。 我编辑了我的问题,并添加了我的配置文件的详细信息。 – 2013-05-07 05:17:01

+0

包装你需要更多关于我的项目的细节,我已经在这里提升了我的项目w.mediafire.com/download.php?em5e83p03jo8zsr 它在VS2012中并使用WIX3.7。 – 2013-05-07 05:30:20

相关问题