【发布时间】:2017-01-20 19:45:38
【问题描述】:
我正在努力在 TFS 2015 上创建构建定义。我们有 *.sln 文件并引用了 *.wixprojthere。在 Wix proj 中,我们使用如下变量:
<File Id="MyFile" Name="MyFile.dll" Source="$(var.SourceLocation)" Vital="yes"/>
这个变量$(var.SourceLocation) 被传递给candle.exe:
C:\Program Files (x86)\WiX Toolset v3.10\bin\candle.exe -d"SourceLocation=D:\agent_work\2\SomeLocation\bin\Debug\"
它在本地工作,因为我们在那里有这样的代码:
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
<ProductVersion>3.8</ProductVersion>
<ProjectGuid>{63f50ecb-3c8f-448c-ad0d-43739e6ad5f1}</ProjectGuid>
<SchemaVersion>2.0</SchemaVersion>
<OutputName>Setup AddIn</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>
<SourceLocation Condition="$(SourceLocation) == '' ">$(SolutionDir)SomeLocation\bin\$(Configuration)\</SourceLocationAddIn>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
<OutputPath>$(SolutionDir)OutPutpathLocation\bin\$(Configuration)\</OutputPath>
<IntermediateOutputPath>obj\$(Configuration)\</IntermediateOutputPath>
<DefineConstants>SourceLocation=$(SourceLocation)</DefineConstants>
<SuppressIces>ICE30;ICE91</SuppressIces>
<Cultures>
</Cultures>
<LinkerAdditionalOptions>-cultures:en-us%3b</LinkerAdditionalOptions>
<CompilerAdditionalOptions>
</CompilerAdditionalOptions>
<SuppressValidation>True</SuppressValidation>
</PropertyGroup>
当我尝试在 TFS 2015 中运行它时,我通过 /p: 参数传递 SourceLocation:
但是失败了。
2017-01-19T13:39:47.3202914Z 57>D:\agent_work\2\s\Setup\Installation\Installation\Sequences.wxs(11): 错误 LGHT0103: 系统找不到文件 '$(Build .BinariesDirectory)MyFile.dll'。 [D:\agent_work\2\s\Setup\Installation\Installation\Installation.wixproj]
如何在 TFS 2015 (vNext) 构建中将我自己的变量传递给 wixproj?
更新:
最后我修好了。正如 Arkady 建议的那样,我刚刚无条件创建了新的 <PropertyGroup>,并从其他地方删除了 <DefineConstants>:
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
<ProductVersion>3.8</ProductVersion>
<ProjectGuid>{63f50ecb-3c8f-448c-ad0d-43739e6ad5f1}</ProjectGuid>
<SchemaVersion>2.0</SchemaVersion>
<OutputName>Setup AddIn</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>
<SourceLocation Condition="$(SourceLocation) == '' ">$(SolutionDir)SomeLocation\bin\$(Configuration)\</SourceLocationAddIn>
</PropertyGroup>
<PropertyGroup>
<DefineConstants>$(DefineConstants);SourceLocationAddIn=$(SourceLocationAddIn);SourceLocationCA=$(SourceLocationCA)</DefineConstants>
</PropertyGroup>
...
看起来$(DefineConstants); 成功了。没有这个,我的构建没有任何参数。
此外,我在 *.wxs 文件中的所有项目上添加了额外的斜杠,如下所示:
<File Id="MyFile" Name="MyFile.dll" Source="$(var.SourceLocation)\" Vital="yes"/>
看看$(var.SourceLocation)\。
(我尝试在 VS 构建步骤中更改此设置,但没有任何效果)。
现在,我在我的 PC 和构建服务器上的 CI 上有了开发工作的解决方案。
【问题讨论】:
标签: visual-studio-2015 wix tfs-2015 azure-pipelines