我们正在使用Wix创建补丁。它在下面给出
<Family DiskId="5000"
MediaSrcProp="Sample"
Name="Sample"
SequenceStart="5000">
<UpgradeImage SourceFile="Z:\MyViewName\Latest_UnCompressed\EmailTrans.msi" Id="Latest">
<TargetImage SourceFile="Z:\MyViewName\Prev_Uncompressed\EmailTrans.msi" Order="2" Id="Previous" IgnoreMissingFiles="no"/>
</UpgradeImage>
</Family>
我不想使用<UpgradeImage SourceFile="Z:\MyViewName
,因为这可能经常发生变化。
我正在使用像下面的Msbuild目标来构建它
<Target Name="CreateUncompressFolder">
<RemoveDir Condition="Exists('$(OldUncompressedMsiPath)')" Directories="$(OldUncompressedMsiPath)" />
<MakeDir Condition="!Exists('$(OldUncompressedMsiPath)')" Directories="$(OldUncompressedMsiPath)" />
<RemoveDir Condition="Exists('$(NewUncompressedMsiPath)')" Directories="$(NewUncompressedMsiPath)" />
<MakeDir Condition="!Exists('$(NewUncompressedMsiPath)')" Directories="$(NewUncompressedMsiPath)" />
</Target>
<Target Name="UnCompressMsi" DependsOnTargets="CreateUncompressFolder">
<Exec Command="msiexec.exe /a "$(NewMsiPath)" /qb TARGETDIR="$(NewUncompressedMsiPath)""/>
<Exec Command="msiexec.exe /a "$(OldMsiPath)" /qb TARGETDIR="$(OldUncompressedMsiPath)""/>
</Target>
<Target Name="BuildMsp">
<Exec Command="candle.exe "$(PatchWxsName)""/>
<Exec Command="light.exe "$(WixObj)" -out "$(PCPName)""/>
<Exec Command="msimsp.exe -s "$(PCPName)" -p "$(MspName)" -l "Patch.log" "/>
</Target>
是否可以通过Msbuild将Z:\ MyViewName作为参数传递?
答案 0 :(得分:1)
您需要使用DefineConstants并让msbuild将参数传递给.wixproj作为参数。在Automating WiX with MSBuild中,您会看到他将 PRODUCTVERSION 作为MSBUILD参数传递给wixproj,然后他可以引用 PRODUCTVERSION 在他的WXS文件中使用 $(var.PRODUCTVERSION)。 我所看到的另一种方法,在我提到的链接中几乎是相同的,而是将XML元素 DefineConstants 作为属性添加到 PropertyGroup 中。 .wixproj文件,而不是在 BeforeBuild 目标中动态创建属性。
E.x:
<Project>
<PropertyGroup>
<Configuration/>
<Platform/>
<DefineConstants>
BuildVersion=$(ProductVersion);
WixVarName=$(MSBuildPropertyName);
WixVarName1=$(MSBuildPropertyName1);
WixVarName2=$(MSBuildPropertyName2);
</DefineConstants>
<OutputPath/>
<OutputName/>