【发布时间】:2010-01-06 21:45:04
【问题描述】:
我是一名学生开发人员,我已经为我现在合作的公司构建了几个安装程序。所以我对WIX相当熟悉。 我们最近决定有一个构建服务器来自动构建我们的解决方案。它构建调试和发布,以及混淆(和非混淆)项目。 你真的不必了解这些。您所要了解的是,我有相同的 Wix 项目动态构建不同的 MSI。 所以我们构建它们的方式是我们用几个参数调用 MSBuild.exe。 wix 项目所依赖的参数。
假设我们进入命令提示符并编写
C:\>\windows\Microsoft.NET\Framework\v3.5\MSBuild.exe MyApp.Install\MyApp.Install.wixproj /p:Configuration=Release /p:SpecialPath=Obfuscated /t:Build
这个想法是 wix 看到“SpecialPath”参数被分配“混淆”;并在安装程序路径中其源到
..\myApp\bin\$(var.SpecialPath)\myApp.exe 在构建时转换为 ..\myApp\bin\Obfuscated\myApp.exe。
问题
如何创建这些自定义构建参数并将它们传递给我的 .wxs 文件。到目前为止,使用 此 设置,$(var.SpecialPath) 尚未定义并且构建 CrashSplosions。
出于明显的法律原因,我不得不删除 90% 的 project.wxs 文件并重命名一些内容,但出于所有意图和目的,这就是我所拥有的。
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product Id="*" Name="myApp" Language="1033" Version="$(var.Version)" Manufacturer="myApp" UpgradeCode="$(var.UpgradeCode)">
<Package Id="*" InstallerVersion="200" Compressed="yes" />
<Media Id="1" Cabinet="media.cab" EmbedCab="yes" />
<Directory Id="TARGETDIR" Name="SourceDir" >
<Directory Id="ProgramFilesFolder">
<Directory Id="INSTALLLOCATION" Name="myApp">
<Component Id="myAppEXE" Guid="FD5EBC02-MY29-GUID-ACCA-61324C5F1B68">
<RegistryKey Root="HKLM" Key="Software\MyApp">
<RegistryValue Value="0" Type="string" KeyPath="yes"/>
</RegistryKey>
<File Id="MYAPPEXE" Name='myApp.exe' Source="..\myApp\bin\$(var.SpecialPath)\myApp.exe" />
</Component>
<Component Id="EngineDLL" Guid="*">
<File Id="ENGINEDLL" Name='Engine.dll' Source="..\myApp\bin\$(var.Configuration)\Engine.dll" />
</Component>
<Component Id="CommonDLL" Guid="*">
<File Id="COMMONDLL" Name='Common.dll' Source="..\myApp\bin\$(var.Configuration)\Common.dll" />
</Component>
</Directory>
</Directory>
</Directory>
<Feature Id="ProductFeature" Title="myApp" Description='All' Display='expand' Level="1" ConfigurableDirectory='INSTALLLOCATION'>
<ComponentRef Id="myAppEXE" />
<ComponentRef Id="EngineDLL" />
<ComponentRef Id="CommonDLL" />
</Feature>
</Product>
</Wix>
【问题讨论】:
标签: dynamic parameters build path wix