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

TeamCity:如何让MSBuild考虑发布配置文件参数?,msbuild,teamcity,Msbuild,Teamcity,当我想用发布配置文件编译我的项目时,我有带有MSBuild步骤的TeamCity构建配置。我的发布配置文件位于MyProject\Properties\PublishProfiles\profile.pubxml中 My profile.pubxml: <Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <PropertyGroup>

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

My 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文件中查看。

添加TeamCity property system.PublishProfile,并且该值应为您的pubxml配置文件名(“配置文件”)在您的示例中)。然后添加一个生成步骤,该步骤使用目标“WebPublish”运行MSBuild,它对我有效。

我发现此解决方案调用WebPublish,但是,FTP发布尚不受支持。