我有一个包含网站项目的解决方案,我已经为Release版本设置了PublishProfile(.pubxml),这是使用/ p:PublishProfile = BuildServerPublish在TFS构建中配置的。该配置文件如下所示:
<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>False</LaunchSiteAfterPublish>
<PrecompileBeforePublish>True</PrecompileBeforePublish>
<EnableUpdateable>True</EnableUpdateable>
<DebugSymbols>False</DebugSymbols>
<WDPMergeOption>DonotMerge</WDPMergeOption>
<ExcludeApp_Data>False</ExcludeApp_Data>
<publishUrl>R:\MyApp\Live</publishUrl>
<DeleteExistingFiles>True</DeleteExistingFiles>
</PropertyGroup>
</Project>
TFS配置为每次签入时都执行Release分支的CI构建,这非常有效。
我现在的问题是我们想要在流程中加入一些登台服务器(QA,UAT等),虽然我在Visual Studio中为这些服务器创建了构建配置和配置转换,但发布配置文件只能定义单个构建配置(在本例中为Release),而且TFS中的构建定义只能指定单个发布配置文件。
最终目标是让TFS构建站点并在单独的子文件夹中多次发布(每次构建配置一次),同时为每个子站点执行适当的配置转换。例如:
R:\ MyApp的\ QA - 包含&#34; QA&#34;转换版本的配置
R:\ MyApp的\ UAT - 包含&#34; UAT&#34;转换版本的配置
R:\ MyApp的\活 - 包含&#34;发布&#34;转换版本的配置
我的第一个想法是为每个构建配置创建单独的发布配置文件,然后使用以下内容在构建配置文件中引用它们: / P:PublishProfile = BuildServerQaPublish | BuildServerUatPublish | BuildServerLivePublish
..但是TFS没有这个。 我的下一个想法是在一个配置文件中有多个发布设置,例如:
<PropertyGroup>
<WebPublishMethod>FileSystem</WebPublishMethod>
<LastUsedBuildConfiguration>Qa</LastUsedBuildConfiguration>
<LastUsedPlatform>Any CPU</LastUsedPlatform>
<SiteUrlToLaunchAfterPublish />
<LaunchSiteAfterPublish>False</LaunchSiteAfterPublish>
<PrecompileBeforePublish>True</PrecompileBeforePublish>
<EnableUpdateable>True</EnableUpdateable>
<DebugSymbols>False</DebugSymbols>
<WDPMergeOption>DonotMerge</WDPMergeOption>
<ExcludeApp_Data>False</ExcludeApp_Data>
<publishUrl>R:\MyApp\Qa</publishUrl>
<DeleteExistingFiles>True</DeleteExistingFiles>
</PropertyGroup>
<PropertyGroup>
<WebPublishMethod>FileSystem</WebPublishMethod>
<LastUsedBuildConfiguration>Uat</LastUsedBuildConfiguration>
<LastUsedPlatform>Any CPU</LastUsedPlatform>
<SiteUrlToLaunchAfterPublish />
<LaunchSiteAfterPublish>False</LaunchSiteAfterPublish>
<PrecompileBeforePublish>True</PrecompileBeforePublish>
<EnableUpdateable>True</EnableUpdateable>
<DebugSymbols>False</DebugSymbols>
<WDPMergeOption>DonotMerge</WDPMergeOption>
<ExcludeApp_Data>False</ExcludeApp_Data>
<publishUrl>R:\MyApp\Uat</publishUrl>
<DeleteExistingFiles>True</DeleteExistingFiles>
</PropertyGroup>
<PropertyGroup>
<WebPublishMethod>FileSystem</WebPublishMethod>
<LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
<LastUsedPlatform>Any CPU</LastUsedPlatform>
<SiteUrlToLaunchAfterPublish />
<LaunchSiteAfterPublish>False</LaunchSiteAfterPublish>
<PrecompileBeforePublish>True</PrecompileBeforePublish>
<EnableUpdateable>True</EnableUpdateable>
<DebugSymbols>False</DebugSymbols>
<WDPMergeOption>DonotMerge</WDPMergeOption>
<ExcludeApp_Data>False</ExcludeApp_Data>
<publishUrl>R:\MyApp\Live</publishUrl>
<DeleteExistingFiles>True</DeleteExistingFiles>
</PropertyGroup>
</Project>
..但那也没有用。 我能想到的唯一另一件事是设置多个构建定义,每个构建定义都引用一个单独的发布配置文件,但我试图避免这种情况有两个原因;首先是因为它意味着有很多构建定义(不仅仅是这个解决方案,而是跨多个项目团队),其次是因为它实际上意味着重复构建相同的代码,只是为了做不同的配置转换。
如果可以在不编辑csproj文件的情况下完成,那将会很好,尽管如果这是唯一的解决方案,那么就这样吧。
任何人都可以帮助我吗?
答案 0 :(得分:0)
我建议您使用发布工具来管理您的版本。
TFS有一个名为Release Management的发布工具,它可以持续将您的应用程序部署到每个单独阶段的特定环境:开发,测试,登台和生产。有关详细信息,请参阅此链接:https://msdn.microsoft.com/en-us/library/dn593700(v=vs.120).aspx