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

8

我有一个TeamCity构建配置,其中包含MSBuild步骤,我想使用发布配置文件编译我的项目。我的发布配置文件位于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

现在我想要使用发布配置文件中的参数编译我的项目。我尝试将所有参数创建为构建配置的系统参数(如TeamCity建议在MSBuild步骤中使用“构建参数”而不是“/property:”,这是什么意思?),但我认为MSBuild没有考虑这些参数,因为我在bin目录中看不到project.dll文件。

我在https://dev59.com/E2Qo5IYBdhLWcg3wSNtw找到了解决方案。 - Konstantin
1个回答

5

添加TeamCity属性system.PublishProfile,值应为你的pubxml配置文件名(在你的示例中是"profile")。然后添加一个构建步骤,运行MSBuild并指定目标为"WebPublish" - 这对我来说有效。


这会调用WebPublish,但是FTP发布尚未被支持。 - Paul Taylor

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接