MSDeploy – sync command to copy files to subfolder of iis app

I want to perform a post-build step to copy some files into a website folder using MSDeploy.

Eventually I’ll be doing this to a remote location (specifying computerName, userName switches etc.), but for now I’m running it locally:

  • How can I publish a subversion repository to a local IIS?
  • Synchronizing Visual SVN with IIS for web development (or to any other folder)
  • IIS 7.5 with process idenity set to user has wrong USERPROFILE
  • Run SVN repositories under IIS
  • Bonobo Git Server - HTTP Error 500.19 - Code: 0x80070021
  • OpenSSL errno 10054,connection refused, whilst trying to connect to our server
  • "C:\Program Files\IIS\Microsoft Web Deploy V3\msdeploy.exe" 
       -AllowUntrusted -verb:sync 
       -source:dirPath="D:\files_to_copy" 
       -dest:iisApp="My Website Name"
    

    This works, but it removes all contents of the website folder and replaces them with the contents of “D:\files_to_copy” (as you might expect!). So I was wondering how I use this simply copy to a subfolder within the site?

    I’ve tried -dest:iisApp="My Website Name/my_subfolder" but this just creates a new IIS app called “my_subfolder” nested within the existing IIS app.

    Any suggestions much appreciated.

  • Jenkins Sonar plugin suddenly stops working
  • Jenkins fails ALL THE TIME with hudson.util.IOException2
  • Jenkins cron format
  • Use Jenkins 'Mailer' inside pipeline workflow
  • Repositories URL in Jenkins + Git
  • Jenkins groovy pipeline - Need sout of command from executing jar file
  • 2 Solutions collect form web for “MSDeploy – sync command to copy files to subfolder of iis app”

    There are providers other than iisApp, maybe dirPath is the one you want for -dest aswell?:

    • dirPath: The dirPath provider synchronizes directory content.
    • filePath: The filePath provider synchronizes individual files.
    • iisApp: The iisApp provider synchronizes directory content to a folder and marks the folder as an application.
    • contentPath: The contentPath provider synchronizes Web site content.

    Anders’s answer above provides the correct information, but the full code I used to successfully carry this out is as follows:

    "C:\Program Files\IIS\Microsoft Web Deploy V3\msdeploy.exe" 
      -AllowUntrusted -verb:sync 
      -source:contentPath="D:\files_to_copy" 
      -dest:contentPath="My Website Name\my_new_folder"
    

    Adding a single file to the root of the site (for example robots.txt) can be done using the following:

    "C:\Program Files\IIS\Microsoft Web Deploy V3\msdeploy.exe" 
      -AllowUntrusted -verb:sync 
      -source:contentPath="D:\my_folder\robots.txt" 
      -dest:contentPath="My Website Name\robots.txt"
    

    Hopefully this is a useful example for others in the future.

    Git Baby is a git and github fan, let's start git clone.