Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to install .NET framework 4.0 as part of installation?

I created bootstrapper,it works but it does not install NET Framework 4.0. After the installation completed my application does not start because no NET Framework 4.0. Why it does not install NETF 4.0?

<ItemGroup>
    <BootstrapperFile Include="Microsoft.Windows.Installer.4.5">
      <ProductName>Windows Installer 4.5</ProductName>
    </BootstrapperFile>
       <BootstrapperPackage Include=".NETFramework,Version=v4.0">
            <Visible>True</Visible>
            <ProductName>.NET Framework 4.0</ProductName>
            <Install>True</Install>
        <Visible>True</Visible>
      </BootstrapperPackage>
  </ItemGroup>
  <Import Project="$(WixTargetsPath)" />
  <Target Name="AfterBuild">
    <GenerateBootstrapper ApplicationFile="DOGInstaller.msi" 
    ApplicationName="DOG" 
    BootstrapperItems="@(BootstrapperFile)" 
    CopyComponents="True" 
    ComponentsLocation="HomeSite"
    OutputPath="$(OutputPath)\en-us\"
    Path="C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bootstrapper" 
    Culture="en" />
  </Target>
like image 337
ZedZip Avatar asked Aug 09 '11 05:08

ZedZip


1 Answers

In the wixproj file, add the following structure. Note that the <WixTargetsPath> tags must reside in the the first <PropertyGroup> node, along with the rest of what's usually there.

<Project>
  <PropertyGroup> <!-- This must be the first PropertyGroup node. -->
    ...
    <WixTargetsPath Condition=" '$(WixTargetsPath)' == '' AND '$(MSBuildExtensionsPath32)' != '' ">$(MSBuildExtensionsPath32)\Microsoft\WiX\v3.x\Wix.targets</WixTargetsPath>
    <WixTargetsPath Condition=" '$(WixTargetsPath)' == '' ">$(MSBuildExtensionsPath)\Microsoft\WiX\v3.x\Wix.targets</WixTargetsPath>
  </PropertyGroup>
  ...
  <ItemGroup>
    <BootstrapperFile Include="Microsoft.Windows.Installer.3.1">
      <ProductName>Windows Installer 3.1</ProductName>
    </BootstrapperFile>
    <BootstrapperFile Include=".NETFramework,Version=v4.0">
      <ProductName>Microsoft .NET Framework 4.0 (x86 and x64)</ProductName>
    </BootstrapperFile>
  </ItemGroup>
  <PropertyGroup>
    <BootstrapperPath>$(ProgramFiles)\Microsoft SDKs\Windows\v7.0A\Bootstrapper\</BootstrapperPath>
  </PropertyGroup>
  <Target Name="AfterBuild">
    <GenerateBootstrapper
      ApplicationFile="$(TargetFileName)"
      ApplicationName="$(OutputName)"
      BootstrapperItems="@(BootstrapperFile)"
      ComponentsLocation="Relative"
      CopyComponents="True"
      OutputPath="$(OutputPath)"
      Path="$(BootstrapperPath)" />
  </Target>
</Product>
like image 131
Hand-E-Food Avatar answered Oct 19 '22 22:10

Hand-E-Food