代码之家  ›  专栏  ›  技术社区  ›  mmr

如何使用完全独立的.NET 4.0安装程序制作WIX 3.5安装程序?

  •  7
  • mmr  · 技术社区  · 14 年前

    继续上一个问题 I asked here ,我现在需要转到VS2010。

    我得到了wix 3.5最新的每周版本,即2010年6月5日的版本。

    以下是我的安装程序的相关内容:

          <ItemGroup>
            <BootstrapperFile Include="Microsoft.Net.Framework.4.0">
              <ProductName>.NET Framework 4.0</ProductName>
            </BootstrapperFile>
            <BootstrapperFile Include="Microsoft.Windows.Installer.4.5">
             <ProductName>Windows Installer 4.5</ProductName>
           </BootstrapperFile>
          </ItemGroup>
    

    <GenerateBootstrapper ApplicationFile="MySetup.msi" ApplicationName="MyProgram" BootstrapperItems="@(BootstrapperFile)" Path="C:\Program Files\Microsoft SDKs\Windows\v7.0A\Bootstrapper\" ComponentsLocation="Relative" OutputPath="$(OutputPath)" Culture="en" />
    

    但是,它只是不起作用。在VS2010中,.NET Framework 4.0和Windows Installer 4.5文件旁边有感叹号,属性页将它们列为“Unknown BuildAction BootstrapperFile”,而生成似乎根本没有安装.NET 4.0。相关警告是:

    C:\source\depot\project\vs2010\WiXSetup\WiXSetup.wixproj(68,5): warning MSB3155: Item 'Microsoft.Net.Framework.4.0' could not be located in 'C:\Program Files\Microsoft SDKs\Windows\v7.0A\Bootstrapper\'.
    
    1 回复  |  直到 14 年前
        1
  •  12
  •   Community kfsone    7 年前

    简单的答案是改变

    <ItemGroup>
        <BootstrapperFile Include="Microsoft.Net.Framework.3.5.SP1" >
           <ProductName>.NET Framework 3.5 SP1</ProductName>
        </BootstrapperFile>
        <BootstrapperFile Include="Microsoft.Windows.Installer.3.1" >
           <ProductName>Windows Installer 3.1</ProductName>
        </BootstrapperFile>
    </ItemGroup>
    
    <Target Name="setup">
        <GenerateBootstrapper
            ApplicationFile="myproduct.msi"
            ApplicationName="myproduct"
            BootstrapperItems="@(BootstrapperFile)"
            Path="C:\Program Files\Microsoft SDKs\Windows\v7.0A\Bootstrapper\"
            ComponentsLocation="Relative"
            OutputPath="$(cddir)"
            Culture="en"/>
    </Target>
    

    <ItemGroup>
        <BootstrapperFile Include=".NETFramework,Version=v4.0" >
           <ProductName>.NET Framework 4.0</ProductName>
        </BootstrapperFile>
        <BootstrapperFile Include="Microsoft.Windows.Installer.3.1" >
           <ProductName>Windows Installer 3.1</ProductName>
        </BootstrapperFile>
    </ItemGroup>
    
    <Target Name="setup">
        <GenerateBootstrapper
            ApplicationFile="myproduct.msi"
            ApplicationName="myproduct"
            BootstrapperItems="@(BootstrapperFile)"
            Path="C:\Program Files\Microsoft SDKs\Windows\v7.0A\Bootstrapper\"
            ComponentsLocation="Relative"
            OutputPath="$(cddir)"
            Culture="en"/>
    </Target>
    

    我通过进入我的机器上的sdk bootstrapper目录(c:\program files\microsoft sdks\windows\v7.0a\bootstrapper),为Visual Studios 2010找到了这个问题。在下面有一个项目列表,可以被wix读取并包括用于引导。在每个文件夹中都有一个名为product.xml的文件。在看了帮助之后 here 为了创建.NET 3.5安装程序,我发现product标记中的productcode属性似乎标识了boostrap元素的名称,因此当我将值更改为c:\program files\microsoft sdks\windows\v7.0a\bootstrapper\packages\dotnetfx40\product.xml中引用的值时,它起作用了。