小编ans*_*iwn的帖子

将Wix属性设置为TFS构建位置

我一直试图找到我的问题的答案,但却找不到; 因此我会在这里提出解决方案.我希望它对其他人有所帮助.

问题:

我希望我的Wix项目能够在TFS 2010构建过程中构建.作为其中的一部分,我希望我的Wix的源文件位置指向TFS的构建位置.例如,我想:

<File Id="ABC" KeyPath="yes" source="C:\Builds\1\MyBuild\assembly.dll" />
Run Code Online (Sandbox Code Playgroud)

成为:

<File Id="ABC" KeyPath="yes" source="$(var.TFSLOCATION)\assembly.dll" />
Run Code Online (Sandbox Code Playgroud)

'TFSLOCATION'是一个wix属性,需要填充TFS构建的位置.这需要在构建过程中发生,其中构建位置路径被传递给Wix项目.

解:

我读了以下文章:

http://www.ageektrapped.com/blog/setting-properties-for-wix-in-msbuild/

这就是我对我的Wix项目文件(wixproj)所做的:

为了从TFS MSBuild进程设置wix属性,wix项目文件需要两个更改:

<PropertyGroup>
    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
    <ProductVersion>3.5</ProductVersion>
    <SourceLocation Condition="'$(SourceLocation)' == '' ">UNKNOWN</SourceLocation>
    <ProjectGuid>{cae7e273-2de5-4a60-9c4f-9da5f094caf5}</ProjectGuid>
    <SchemaVersion>2.0</SchemaVersion>
    <OutputName>N4S.MSO.BAM.Installer</OutputName>
    <OutputType>Package</OutputType>
    <WixTargetsPath Condition=" '$(WixTargetsPath)' == '' AND '$(MSBuildExtensionsPath32)' != '' ">$(MSBuildExtensionsPath32)\Microsoft\WiX\v3.x\Wix.targets</WixTargetsPath>
    <WixTargetsPath Condition=" '$(WixTargetsPath)' == '' ">$(MSBuildExtensionsPath)\Microsoft\WiX\v3.x\Wix.targets</WixTargetsPath>
    <SccProjectName>SAK</SccProjectName>
    <SccProvider>SAK</SccProvider>
    <SccAuxPath>SAK</SccAuxPath>
    <SccLocalPath>SAK</SccLocalPath>
  </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Release' "> 
  <OutputPath>bin\$(Configuration)\</OutputPath> 
  <IntermediateOutputPath>obj\$(Configuration)\</IntermediateOutputPath>
  <DefineConstants>LOCATION=$(SourceLocation)</DefineConstants>
</PropertyGroup>
Run Code Online (Sandbox Code Playgroud)

在上面的xml中,请注意以下两行:

<SourceLocation Condition="'$(SourceLocation)' == '' ">UNKNOWN</SourceLocation>

<DefineConstants>LOCATION=$(SourceLocation)</DefineConstants> …
Run Code Online (Sandbox Code Playgroud)

tfs wix tfsbuild tfs2010

7
推荐指数
2
解决办法
5941
查看次数

标签 统计

tfs ×1

tfs2010 ×1

tfsbuild ×1

wix ×1