TeamCity:如何告诉MSBuild考虑发布配置文件参数? [英] TeamCity: How tell MSBuild to take into account publish profile parameters?
问题描述
当我想使用发布配置文件编译我的项目时,我具有使用MSBuild步骤进行的TeamCity构建配置.我的发布配置文件位于 MyProject \ Properties \ PublishProfiles \ profile.pubxml .
I have TeamCity build configuration with MSBuild step, when i would like to compile my project with publish profile. My publish profile is located in MyProject\Properties\PublishProfiles\profile.pubxml.
我的profile.pubxml:
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<WebPublishMethod>FileSystem</WebPublishMethod>
<LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
<LastUsedPlatform>Any CPU</LastUsedPlatform>
<SiteUrlToLaunchAfterPublish />
<LaunchSiteAfterPublish>True</LaunchSiteAfterPublish>
<PrecompileBeforePublish>True</PrecompileBeforePublish>
<EnableUpdateable>True</EnableUpdateable>
<DebugSymbols>False</DebugSymbols>
<WDPMergeOption>MergeAllOutputsToASingleAssembly</WDPMergeOption>
<UseMerge>True</UseMerge>
<SingleAssemblyName>project</SingleAssemblyName>
<ExcludeApp_Data>False</ExcludeApp_Data>
<publishUrl>C:\DevelopmentFolder</publishUrl>
<DeleteExistingFiles>True</DeleteExistingFiles>
</PropertyGroup>
</Project>
我的构建步骤:
Runner type: MSBuild
Build file path: MyProject.csproj
MSBuild version: Microsoft Build Tools 2013
MSBuild ToolsVersion: 12
Run platform: x86
现在,我想根据我的发布配置文件中的参数来编译我的项目.我尝试将所有参数创建为构建配置的系统参数(如),但我认为MSBuild不会使用进入帐户参数,因为我在 bin 目录 project.dll 文件中看不到.
Now i would like to compile my project with account of parameters from my publish profile. I try to create all parameters as system parameters of build configuration (as in TeamCity says to use "Build Parameters" instead of "/property:" in an MSBuild step. What does that mean?), but i think MSBuild does not take into account parameters, because i can't see in bin directory project.dll file.
推荐答案
添加TeamCity属性system.PublishProfile,该值应为您的pubxml配置文件名称(在您的示例中为"profile").然后添加一个以目标"WebPublish"运行MSBuild的构建步骤-对我有用.
Add TeamCity property system.PublishProfile and the value should be your pubxml profile name ("profile" in your example). Then add a build step which runs MSBuild with the target "WebPublish" - it works for me.
这篇关于TeamCity:如何告诉MSBuild考虑发布配置文件参数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!