TeamCity:如何告诉MSBuild考虑发布配置文件参数?

Kon*_*tin 6 msbuild teamcity

我有使用MSBuild步骤的TeamCity构建配置,当我想用​​发布配置文件编译我的项目时.我的发布配置文件位于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>
Run Code Online (Sandbox Code Playgroud)

我的构建步骤:

Runner type: MSBuild
Build file path: MyProject.csproj
MSBuild version: Microsoft Build Tools 2013
MSBuild ToolsVersion: 12
Run platform: x86
Run Code Online (Sandbox Code Playgroud)

现在我想用我的发布配置文件中的参数来编译我的项目.我尝试将所有参数创建为构建配置的系统参数(如在TeamCity中说在MSBuild步骤中使用"构建参数"而不是"/ property:".这意味着什么?),但我认为MSBuild不会考虑帐户参数,因为我无法在bin目录中看到project.dll文件.

Kon*_*man 5

添加TeamCity属性system.PublishProfile,值应该是您的pubxml配置文件名称(在您的示例中为"profile").然后添加一个使用目标"WebPublish"运行MSBuild的构建步骤 - 它适用于我.