How to install redistributable package of .NET Framework with Wix?

て烟熏妆下的殇ゞ 提交于 2019-12-22 13:55:18

问题


I have a general task: install .NET Framework 3.5 during the setup of my product.

I do the following:

  1. I have created a custom action X
  2. Custom action X starts an executable Y via Process.Start()
  3. Executable Y kills the msiexec process and run .NET Framework setup package

Here appear some problems: .NET Framework setup says that Windows Installer Service is not accessible and asks to terminate all another installations!

I think, the cause of it is that Process.Kill() method terminate the process incorrect. When I kill the msiexec process via Kill() the msiserver service is NOT STOPPABLE, but if I finish setup by clicking Cancel button, msiserver service becomes STOPPABLE.

How can I solve the problem?


回答1:


Here is how to bootstrap the .NET framework.

1) Be sure you have the .NET 3.5 and Windows Installer 3.1 boostrappers on your build machine. They should be installed with VS. They can likely be found here: C:\Program Files (x86)\Microsoft SDKs\Windows\v6.0A\Bootstrapper\Packages\DotNetFX35.

2) Edit the wix project file. - Right click on the project, select unload - Right click again, and edit the wixproj

3) Add the following item group:

<ItemGroup>
  <BootstrapperFile Include="Microsoft.Windows.Installer.3.1">
    <ProductName>Windows Installer 3.1</ProductName>
  </BootstrapperFile>
  <BootstrapperFile Include="Microsoft.Net.Framework.3.5.SP1">
    <ProductName>.NET Framework 3.5</ProductName>
  </BootstrapperFile>

4) Add the following at the end of the project file

    <Target Name="AfterBuild">
  <GenerateBootstrapper ApplicationFile="$(TargetFileName)" ApplicationName="My Application Name" BootstrapperItems="@(BootstrapperFile)" ComponentsLocation="Relative" CopyComponents="True" OutputPath="$(OutputPath)" Path="C:\Program Files (x86)\Microsoft SDKs\Windows\v6.0A\Bootstrapper\" /></Target>

5) Now build. The resulting setup.exe & msi should install the framework.

Scott



来源:https://stackoverflow.com/questions/4758862/how-to-install-redistributable-package-of-net-framework-with-wix

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!