如何使Web部署(msdeploy)部署在其他文件夹中? [英] How to make Web Deploy (msdeploy) deploy in a different folder?

查看:159
本文介绍了如何使Web部署(msdeploy)部署在其他文件夹中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试制作一个简单的概念验证Web部署方案.我的目标是:

I'm trying to make a simple proof-of-concept Web Deployment scenario. My goal is to:

  1. 使用一个包含几个文件的文件夹并将其打包为.zip文件
  2. 将.zip文件解包到不同文件夹中
  3. 从解压后的文件夹中运行一个.exe(也让该.exe知道解压缩的位置).
  1. Take a folder with a few files and package them in a .zip file
  2. Unpackage the .zip file in a different folder
  3. Run a .exe from the unpacked folder (also letting the .exe know where it was unpacked).

我正在没有安装IIS的虚拟机上执行此操作,否则它出于某种原因希望读取IIS配置,即使它不需要执行任何操作(并且由于缺少管理权限而失败).

I'm doing this on a virtual machine without an IIS installed, otherwise it wants to read IIS config for some reason, even if it doesn't need to do anything with it (and fails because it lacks administrative rights).

我有以下文件:

C:\Temp\TheFolder\readme.txt
C:\Temp\TheFolder\MagicScript\CSTest.exe

.zip包是通过清单创建的:

The .zip package is created via a manifest:

<sitemanifest>
  <contentPath path="C:\Temp\TheFolder"/>
  <runCommand path="C:\Temp\TheFolder\MagicScript\CSTest.exe"/>
</sitemanifest>

对于包装,我使用以下命令:

For packaging I use the following command:

msdeploy -verb:sync -source:manifest=manifest.xml -dest:package=ready.zip

要打开包装,请使用以下命令:

For unpackaging I use the following command:

msdeploy -verb:sync -source:package=ready.zip -dest:auto -replace:match=TheFolder,replace=OtherFolder

但是,MSDeploy顽固地将所有内容打包在同一TheFolder中. .exe文件也不会从未打包的文件夹中运行.而是将其复制到临时文件夹,然后从那里运行,当前目录设置为我从中运行部署脚本的位置.

However MSDeploy stubbornly unpackages everything in the same TheFolder. The .exe file is also run not from the unpackaged folder. Rather it's copied to a temp folder and then run from there, with the current directory set to wherever I ran the deployment script from.

我也尝试使用参数而不是替换,但这仍然没有任何效果.

I also tried using a parameter instead of replace, but that still didn't have any effect.

我在做什么错了?

推荐答案

"msdeploy -verb:sync"-执行源和目标之间的同步.如果您使用自动"提供程序-它将源与目标同步,因此,在您的情况下,在同一台PC上,它是同一文件夹. 替换"参数仅适用于文件.

"msdeploy -verb:sync" - performs syncronization between source and destination. If you use "auto" provider - it synchronizes source with destination, so in your case at the same PC it is the same folder. "replace" parameter works only for files.

您可以尝试以下方式:

msdeploy -verb:sync -source:package=ready.zip -dest:contentPath="C:\Temp\OtherFolder"

或者,如果不起作用,请尝试使用目标清单:

Or, if it won't work, try to use destination manifest:

msdeploy -verb:sync -source:package=ready.zip -dest:-source:manifest=manifestDestination.xml

manifestDestination.xml在哪里:

Where manifestDestination.xml is:

<sitemanifest>
  <contentPath path="C:\Temp\OtherFolder"/>
  <runCommand />
</sitemanifest>

这篇关于如何使Web部署(msdeploy)部署在其他文件夹中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆