MsDeploy remoting executing manifest twice

后端 未结 2 1523
长情又很酷
长情又很酷 2021-02-03 11:14

I have:

  1. Created a manifest for msdeploy to:
    Stop, Uninstall, Copy over, Install, and Start a Windows service.
  2. Created a package from the manifest
2条回答
  •  孤街浪徒
    2021-02-03 12:05

    I had the same problem, but I don't make package.zip file. I perform synchronization directly in one step. The preSync/postSync solution helped me a lot and there is no need to use manifest files. You can try the following command in your case:

    "C:\Program Files\IIS\Microsoft Web Deploy V2\msdeploy"  
    -verb:sync 
    -preSync:runCommand="net stop TestSv && C:\Windows\Microsoft.NET\Framework\v4.0.30319\installutil.exe /u
           C:\msdeploy\TestSvc\TestSvc\bin\Debug\TestSvc.exe",waitInterval=240000,waitAttempts=1 
    -source:dirPath="C:\msdeploy\TestSvc\TestSvc\bin\Debug"
    -dest:auto,computername=
    -postSync:runCommand="C:\Windows\Microsoft.NET\Framework\v4.0.30319\installutil.exe
        C:\msdeploy\TestSvc\TestSvc\bin\Debug\TestSvc.exe && net start TestSvc",waitInterval=240000,waitAttempts=1
    

    "-verb:sync" parameter means you synchronize data between a source and a destination. In your case your case, first time you perform synchronization between the "C:\msdeploy\TestSvc\TestSvc\bin\Debug" folder and the "package.zip". Plus, you are using manifest file, so when you perform second synchronization between the "package.zip" and the destination "computername", msbuild uses previously provided manifest twice for the destination and for the source, so each manifest operation runs twice. I used the && trick to perform several commands in one command line. Also, in my case, I had to add timeout operation to be sure the service were completely stopped ("ping -n 30 127.0.0.1 > nul").

提交回复
热议问题