我正在使用 TFS 和 Visual Studio 2017。我有两台服务器用于负载平衡,两台服务器都有我的 MVC 应用程序的相同发行版本(理论上)。
目前的发布流程如下:
- 通过将所有文件复制到 _old 文件夹来备份现有的根文件夹。
- 手动将发布文件复制到服务器上,即 Ctrl+c 和 Ctrl+v。
我对服务器 2 做同样的事情。
我想知道是否有一种方法可以自动执行此操作。
我尝试了以下方法:我创建了一个发布配置文件,一次将发布到一台服务器,这是有效的,但是现有文件的备份(即第 1 步)仍然是手动的,而且我必须这样做两次每个服务器(即,必须创建两个配置文件而不是 1 个)
我确实尝试如下调整 pubxml 文件 我的 *.pubxml 文件如下所示:
<?xml version="1.0" encoding="utf-8"?>
<!--
This file is used by the publish/package process of your Web project. You can customize the behavior of this process
by editing this MSBuild file. In order to learn more about this please visit https://go.microsoft.com/fwlink/?LinkID=208121.
-->
<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>
<ExcludeApp_Data>False</ExcludeApp_Data>
<publishUrl>\\10.0.0.100\c$\Applications\TestApps\Test</publishUrl>
<publishUrl>\\10.0.0.101\c$\Applications\TestApps\Test</publishUrl>
<DeleteExistingFiles>False</DeleteExistingFiles>
</PropertyGroup>
</Project>
当我尝试使用此发布配置文件进行发布时,上述内容不起作用,这很有趣。只有服务器 2 (10.0.0.101) 收到了我的更改,任何人都可以帮忙。
我正在使用 Visual Studio 2017 Visual Studio Team Foundation Server 15.117.26714.0