从Wix安装.NET Framework

我正在使用WiX工具集v3.7和Visual Studio 2013为Excel插件创build安装程序包。

该插件依赖于.NET Framework 4.5,我希望安装程序自动检测目标机器上是否存在所需的框架,如果没有,请安装它。

谷歌search让我到这个网页: http : //wix.sourceforge.net/manual-wix3/install_dotnet.htm ,但是如何创build一个捆绑的指示链接是打破了该页面。

我已经尝试将元素添加到我的根元素,但结束了错误。 我也尝试了一些我在网上find的例子,但是在VS2013项目创build过程中,没有一个能够正确使用默认的WiX清单。

我需要添加到我的清单,以启用.NET Framework 4.5的自动安装?

我非常感谢这里的任何帮助! 我的清单如下所示:

<?xml version="1.0" encoding="UTF-8"?> <Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"> <Product Id="*" Name="Awesome Excel Add-in 1.0" Language="1033" Version="1.0" Manufacturer="Farhan Ahmed" UpgradeCode="7ffd5a6d-d38e-4d6b-b554-098d95791222"> <Package Description="Awesome Excel Add-in Installer" InstallerVersion="200" Compressed="yes" InstallScope="perMachine" /> <Condition Message="You need to be an administrator to install this product."> Privileged </Condition> <MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." /> <MediaTemplate /> <Feature Id="ProductFeature" Title="AwesomeExcelSetup" Level="1"> <ComponentGroupRef Id="ProductComponents" /> </Feature> <CustomAction Id='LaunchInstallerFile' FileKey='fAddinInstaller' ExeCommand='/I /64' Return='asyncWait' /> <CustomAction Id='LaunchRemoverFile' FileKey='fAddinInstaller' ExeCommand='/U' Return='check' /> <InstallExecuteSequence> <Custom Action='LaunchInstallerFile' After='InstallFinalize'>NOT Installed</Custom> <Custom Action='LaunchRemoverFile' Before='RemoveFiles'>Installed AND NOT REINSTALL</Custom> </InstallExecuteSequence> <UI> <UIRef Id="WixUI_Minimal" /> </UI> <Icon Id="icon.ico" SourceFile="$(var.AwesomeExcelAddin.TargetDir)\Awesome.ico"/> <Property Id="ARPPRODUCTICON" Value="icon.ico" /> </Product> <Fragment> <Directory Id="TARGETDIR" Name="SourceDir"> <Directory Id="ProgramFilesFolder" Name="PFiles"> <Directory Id="INSTALLPARENT" Name="Awesome" > <Directory Id="INSTALLFOLDER" Name="Excel Add-in 1.0" /> </Directory> </Directory> </Directory> </Fragment> <Fragment> <ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER"> <Component Id="ProductComponent" Guid="DDD3F332-0DF1-47F0-B8D0-5E1E09BF69BE"> <File Id="f32bitXLL" Source="$(var.AwesomeExcelAddin.TargetDir)\AwesomeAddinPacked32.xll" /> <File Id="f64bitXLL" Source="$(var.AwesomeExcelAddin.TargetDir)\AwesomeAddinPacked64.xll" /> <File Id="fAddinDll" Source="$(var.AwesomeExcelAddin.TargetDir)\AwesomeExcelAddin.dll" /> <File Id="fAddinInstaller" Source="$(var.AwesomeExcelAddinInstaller.TargetDir)\AwesomeExcelAddinInstaller.exe" /> </Component> </ComponentGroup> </Fragment> </Wix> 

感谢Netfangled的评论,我能够继续前进。

就像他(她?)提到的,诀窍是为Bootstrapper创建另一个项目,然后在该清单中引用.NET Fx和MSI。

虽然我遇到了“环境变量未定义”的问题,但是我能够通过指定一个使用Solution目录作为基础的源文件来解决这个问题。

这是新的清单:

 <?xml version="1.0" encoding="UTF-8"?> <Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"> <Bundle Name="Awesome Excel Plugin Setup" Version="1.0.0.0" Manufacturer="Awesome Software" UpgradeCode="1f605e3b-2954-403c-b9cb-ca1f0e8bf65b"> <WixVariable Id="WixStdbaLogo" Value="Logo.png" /> <BootstrapperApplicationRef Id="WixStandardBootstrapperApplication.RtfLicense" /> <WixVariable Id="WixStdbaLicenseRtf" Value="License.rtf" /> <Chain> <PackageGroupRef Id="NetFx45Redist"/> <MsiPackage Id="AwesomeExcelSetupMSI" SourceFile="$(var.SolutionDir)\AwesomeExcelSetup\bin\release\AwesomeExcelSetup.msi" Vital="yes" Compressed="yes"/> </Chain> </Bundle> </Wix>