Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I make a WiX 3.5 installer with a completely self-contained .NET 4.0 installer?

Continuing a previous question I asked here, I now need to move to vs2010.

I've gotten the most recent weekly build of WiX 3.5, the June 5th 2010 version.

Here's the relevant lines from my installer:

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

and

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

However, it's just not working. In vs2010, there are exclamation points next to the .NET Framework 4.0 and Windows Installer 4.5 files, and the properties page lists them as 'Unknown BuildAction BootstrapperFile', and the build just does not appear to install .NET 4.0 at all. The relevant warning is:

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\'.
like image 768
mmr Avatar asked Jun 10 '10 19:06

mmr


People also ask

How do I create a Windows Installer MSI .NET core WiX?

To do this, right-click on the project in Solution Explorer and select “Add > Existing Item”. Browse to your app's files and add them to the project. After you've added your app files, you're ready to build the project. Just go to Build > Build Solution and the Windows installer will be created for you.

How does WiX Installer work?

The WiX tools follow the traditional compile and link model used to create executables from source code. At build time, the WiX source files are validated against the core WiX schema, then processed by a preprocessor, compiler, and linker to create the final result.

What is WiX Visual Studio?

The Visual Studio WiX toolset allows you to easily create WiX projects, edit WiX files using IntelliSense, and compile/link your project within the Visual Studio IDE.


1 Answers

The short answer is to change

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

to

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

I figured this out by going into the SDK bootstrapper directory (C:\Program Files\Microsoft SDKs\Windows\v7.0A\Bootstrapper) on my machine, for Visual Studios 2010. Under there is a list of projects that can be read by Wix and included for bootstrapping. In each folder there is a file called Product.xml. After looking at the help here for creating a .NET 3.5 installer I found that the ProductCode attribute in the Product tag appears to identify the name of the boostrap element, so when I changed the value to that referenced in C:\Program Files\Microsoft SDKs\Windows\v7.0A\Bootstrapper\Packages\DotNetFX40\Product.xml it worked.

like image 55
Jon Avatar answered Sep 22 '22 05:09

Jon