15

The following is the generated publish profile for my dev environment:

<?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>

What I want to do I would imagine is very easy, I simply want to add an additional publish url where I want to publish the same project. Unfortunately I haven´t been able to find anything on how to do this in a straightforward manner. All suggests that I need to implement some complex msdeploy solution or simply fallback to scripting (i.e. ps/batch + robocopy/xcopy) which is undesirable.

I imagined one could simply do something like:

<publishUrl>\\dev\webroot;\\dev2\webroot2</publishUrl>

or

<itemGroup>
<publishUrl>\\dev\webroot;</publishUrl>
<publishUrl>\\dev2\webroot;</publishUrl>
</itemGroup>

The main question is: How can I extend my publish profile to deploy to multiple locations via FTP or the file system?

In case of RTFM responses - please refer to somewhere I can read up on this.

UPDATE If it is possible to do multiple deploy with FTP I would be interested in such a solution as well.

Marcus
  • 8,230
  • 11
  • 61
  • 88
  • A post build copy of the original output would be preferable here. Why would you want to execute the entire build and publishing pipeline for both locations? – gregpakes Feb 25 '14 at 03:56
  • I don´t, I want to include multiple paths to publish locations. Maybe I was unclear. The point I am making is that I wish to avoid unnecessary scripting hell and a complicated deploy chain if possible. – Marcus Feb 25 '14 at 07:55
  • What did you end up doing? – Sam Trost May 19 '17 at 14:39
  • 4
    Finally entered scriptinfghell – Marcus May 19 '17 at 14:42

2 Answers2

0

I'm not sure the publish option in VS was developed with that in mind. The only thing I might suggest is that when your project is deployed to the first destination you use a tool like robocopy to copy everything over to a new folder, it's quite simple to use, here is a sample command line use:

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
Terry Kernan
  • 746
  • 5
  • 12
0

I'm using VS 2012; not sure what version of VS you are using - but you are using publish profiles so below should work.

I think that you simply need to create a new publish profile that you will then configure to use your additional publish URL. Seems simple so I hope I'm not missing something in your question. Create New Publish Profile

PBMe_HikeIt
  • 659
  • 8
  • 24
  • 4
    As far as I know, MSBUILD does not allow multiple publish profiles as parameters. I wish to automate, not to manually go and publish. This is a part of a larger deploy chain. – Marcus Apr 22 '14 at 13:14