Use MSDeploy to copy an executable to a server and to then run same

前端 未结 1 952
醉酒成梦
醉酒成梦 2021-02-06 03:48

I\'ve got MSDeploy/WebDeploy working a treat to update my web applications - this resolves about 90% of my deployment issues for the things I\'ve got set up so far.

What

1条回答
  •  我在风中等你
    2021-02-06 04:17

    Web Deploy actually offers quite a few options here. Which options you choose kind of depends on how many things you want to put into one command.

    To get a folder of files over to the destination, you could use the Web Deploy’s dirPath provider to do the copying to the location of your choice. To copy an individual file, you can use the filePath provider. If your copy source has many small files, Web Deploy is actually more performant than RoboCopy over a network (see my blog post Web Deploy vs. Robocopy).

    To run the command file that you copied to the destination server, you can use the runCommand provider. (This is an important one, I would definitely read up on it.)

    Note that at this point we’re talking about at least two separate Web Deploy commands, not counting any of the “usual” Web Deploy operations like deploying a website or web server.

    However, if your goal is to achieve everything in one Web Deploy operation, you can use the manifest provider. Create a custom manifest file that specifies a series of Web Deploy provider operations that will execute in turn. Then, in the Web Deploy command, point the manifest provider to the custom manifest file. For more information on this approach, see Creating and Synchronizing a Custom Manifest.

    If you do use the manifest provider, you could specify the dirPath provider in the manifest file to copy the file or files over, and then specify the runCommand provider on a subsequent line to actually run the executable that you copied over.

    Finally, an approach one step short of using a manifest file is to use the preSync and/or postSync command line switches to run a command on the destination server before or after the actual Web Deploy operation takes place. You can find more information on preSync and postSync on the Web Deploy Operation Settings page.

    All of the pages referenced have syntax examples, so that should help.

    0 讨论(0)
提交回复
热议问题