如何扩展我的发布配置文件以部署到多个位置?

Mar*_*cus 12 deployment msbuild visual-studio publish-profiles

以下是我的开发环境的生成发布配置文件:

<?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 http://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>\\dev\webroot</publishUrl>
    <DeleteExistingFiles>False</DeleteExistingFiles>
  </PropertyGroup>
</Project>
Run Code Online (Sandbox Code Playgroud)

我想要做的是我想象的非常简单,我只想在我想要发布同一个项目的地方添加一个额外的发布网址.不幸的是,我还没能找到任何关于如何以直截了当的方式做到这一点.所有这些都表明我需要实现一些复杂的msdeploy解决方案,或者简单地回退到脚本(即p​​s/batch + robocopy/xcopy),这是不可取的.

我想象一个人可以简单地做一些事情:

<publishUrl>\\dev\webroot;\\dev2\webroot2</publishUrl>
Run Code Online (Sandbox Code Playgroud)

要么

<itemGroup>
<publishUrl>\\dev\webroot;</publishUrl>
<publishUrl>\\dev2\webroot;</publishUrl>
</itemGroup>
Run Code Online (Sandbox Code Playgroud)

主要问题是: 如何通过FTP或文件系统扩展我的发布配置文件以部署到多个位置?

如果是RTFM响应 - 请参考我可以阅读的内容.

更新 如果可以使用FTP进行多次部署,我也会对这样的解决方案感兴趣.

Ter*_*nan 0

我不确定 VS 中的发布选项是考虑到这一点而开发的。我唯一建议的是,当您的项目部署到第一个目的地时,您可以使用像 robocopy 这样的工具将所有内容复制到新文件夹,它使用起来非常简单,这是一个示例命令行使用:

robocopy <SRCFOLDER> <TGTFOLDER> /E /XO /XF *.config

rem /E  : Copy Subfolders, including Empty Subfolders.
rem /XO : eXclude Older - if destination file exists and 
          is the same date or newer than     the source - don't overwrite it.
rem /XF *.config : excludes all .config files from copy operation
Run Code Online (Sandbox Code Playgroud)

  • 正如我的问题中所述,这正是我试图避免的。 (2认同)