如何在安装过程中安装 .NET Framework 4.0? [英] How to install .NET framework 4.0 as part of installation?

查看:40
本文介绍了如何在安装过程中安装 .NET Framework 4.0?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了引导程序,它可以工作但它不安装 NET Framework 4.0.安装完成后,我的应用程序无法启动,因为没有 NET Framework 4.0.为什么不安装 NETF 4.0?

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 SDKsWindowsv7.0ABootstrapper" 
    Culture="en" />
  </Target>

推荐答案

在wixproj文件中,添加如下结构.请注意,<WixTargetsPath> 标记必须位于第一个 <PropertyGroup> 节点中,以及通常存在的其余部分.

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)MicrosoftWiXv3.xWix.targets</WixTargetsPath>
    <WixTargetsPath Condition=" '$(WixTargetsPath)' == '' ">$(MSBuildExtensionsPath)MicrosoftWiXv3.xWix.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 SDKsWindowsv7.0ABootstrapper</BootstrapperPath>
  </PropertyGroup>
  <Target Name="AfterBuild">
    <GenerateBootstrapper
      ApplicationFile="$(TargetFileName)"
      ApplicationName="$(OutputName)"
      BootstrapperItems="@(BootstrapperFile)"
      ComponentsLocation="Relative"
      CopyComponents="True"
      OutputPath="$(OutputPath)"
      Path="$(BootstrapperPath)" />
  </Target>
</Product>

这篇关于如何在安装过程中安装 .NET Framework 4.0?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆