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

时间:2014-10-10 14:44:33

标签: msbuild teamcity

当我想用发布配置文件编译我的项目时,我有使用MSBuild步骤的TeamCity构建配置。我的发布配置文件位于 MyProject \ Properties \ PublishProfiles \ profile.pubxml

我的个人资料.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

现在我想用我的发布配置文件中的参数帐户编译我的项目。我尝试将所有参数创建为构建配置的系统参数(如TeamCity says to use "Build Parameters" instead of "/property:" in an MSBuild step. What does that mean?),但我认为MSBuild没有考虑参数,因为我无法在 bin 中看到目录 project.dll 文件。

1 个答案:

答案 0 :(得分:5)

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