本文介绍了打破MsBuild包&部署到单独的MsBuild和MsDeploy命令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有几个问题将MsBuild包+ deploy命令分成两个单独的命令。 (我需要这样做才能将其他参数传递给MsDeploy)。



正常工作的命令如下所示:

  msbuild 
/ P:Configuration = Deploy-Staging
/ P:DeployOnBuild = True
/ P:DeployTarget = MSDeployPublish
/ P:MsDeployServiceUrl = https: //192.168.0.1:8172/MsDeploy.axd
/P:DeployIISAppPath=staging.website.com
/ P:AllowUntrustedCertificate = True
/ P:MSDeployPublishMethod = WmSvc
/ P:CreatePackageOnPublish = True
/ P:UserName = staging-deploy
/ P:Password = xyz

分离的打包命令如下所示:

  msbuildsrc \Solution.sln
/ P:配置=部署 - 分段
/ P:DeployOnBuild = True
/ P:DeployTarget =软件包
/ P:_PackageTempDir = C:\temp\web

哪个工作正常。但是MsDeploy部分:

  msdeploy 
-verb:sync
-allowUntrusted
- usechecksum
-source:manifest =
'src\WebProject\obj\Deploy-Staging\Package\WebProject.SourceManifest.xml'
-dest:auto,ComputerName =
'https://192.168.0.1:8172/MsDeploy.axd?site=staging.website.com',
username ='staging-deploy',password ='xyz',authType ='basic' ,includeAcls ='false'
-enableRule:DoNotDeleteRule

失败,出现以下错误WmSvc.log

  wmsvc.exe错误:0:尝试执行未经授权的操作。 
setAcl / C:\temp\web(Read)
ProcessId = 15784
ThreadId = 31
DateTime = 2011-03-30T14:57:02.4867689Z
Timestamp = 3802908721815
wmsvc.exe错误:0:未授权。
详细信息:没有找到可以授权用户'staging-deploy'的规则,
provider'setAcl',操作'Read',路径'C:\temp\web'。

(还有几个读/写操作)



它正在尝试访问的路径显然有问题(因为其他方法可以正常工作) - 我不知道甚至会正确使用iisApp目标,而现在我不认为正确的web.config将被部署。

解决方案

我现在已经修复了 - 我需要一个不同的命令一个自动生成的.cmd文件正在使用,但比较两个允许我修复它(感谢@Vishal R. Joshi)



我需要的差异是: / p>


  • 基本身份验证

  • 允许不可信证书

  • = staging.webserver在MsBuild.axd路径的末尾,像我原来的命令

  • 覆盖在params文件中设置的IIS Web App名称

  • 启用不要删除规则



获胜命令如下:

  msdeploy 
-verb:sync
-allowUntrusted
-source:package ='src\WebProject\obj\Deploy-Staging\Package\WebProject.zip'
-dest:auto,ComputerName =
'https://192.168.0.1 :8172 / MsDeploy.axd?site = staging.website.com',
username ='staging-deploy',password ='xyz',authType ='basic',includeAcls ='false'
setParamFile :
src\WebProject\obj\Deploy-Staging\Package\WebProject.SetParameters.xml
-setParam:name ='IIS Web Application Name',value ='staging。 website.com'
-enableRule:DoNotDeleteRule
-disableLink:AppPoolExtension -disableLink:ContentExtension
-disableLink:CertificateExtension

希望这有助于某人!


I'm having a few problems breaking out an MsBuild package+deploy command into two separate commands. (I need to do this to pass additional parameters to MsDeploy).

The command that works fine looks like this:

msbuild "src\Solution.sln"
  /P:Configuration=Deploy-Staging
  /P:DeployOnBuild=True
  /P:DeployTarget=MSDeployPublish
  /P:MsDeployServiceUrl=https://192.168.0.1:8172/MsDeploy.axd
  /P:DeployIISAppPath=staging.website.com
  /P:AllowUntrustedCertificate=True
  /P:MSDeployPublishMethod=WmSvc
  /P:CreatePackageOnPublish=True
  /P:UserName=staging-deploy
  /P:Password=xyz

The separated packaging command looks like this:

msbuild "src\Solution.sln"
  /P:Configuration=Deploy-Staging
  /P:DeployOnBuild=True
  /P:DeployTarget=Package
  /P:_PackageTempDir=C:\temp\web

which works fine. But then the MsDeploy portion:

msdeploy
 -verb:sync
 -allowUntrusted
 -usechecksum
 -source:manifest=
  'src\WebProject\obj\Deploy-Staging\Package\WebProject.SourceManifest.xml'
 -dest:auto,ComputerName=
  'https://192.168.0.1:8172/MsDeploy.axd?site=staging.website.com',
   username='staging-deploy',password='xyz',authType='basic',includeAcls='false'
 -enableRule:DoNotDeleteRule

fails, with the following error in WmSvc.log

wmsvc.exe Error: 0 : Attempted to perform an unauthorized operation.
setAcl/C:\temp\web (Read)
ProcessId=15784
ThreadId=31
DateTime=2011-03-30T14:57:02.4867689Z
Timestamp=3802908721815
wmsvc.exe Error: 0 : Not authorized.
Details: No rule was found that could authorize user 'staging-deploy',
         provider 'setAcl', operation 'Read', path 'C:\temp\web'.

(and several more Read/Write operations)

Something is clearly going wrong with the paths it's trying to access (as it works fine with the other method) - I'm not sure it's even trying to use the iisApp targeting correctly, and at the moment I don't think the correct web.config's will be deployed either.

解决方案

I've got this fixed now - I needed a different command to the one the automatically generated .cmd file was using, but comparing the two allowed me to fix it up (thanks @Vishal R. Joshi)

The differences I needed was:

  • basic authentication
  • allow untrusted certificates
  • ?site=staging.webserver on the end of the MsBuild.axd path, as with my original command
  • override the IIS Web App name that is set in the params file
  • enable the do not delete rule

The winning command is as follows:

msdeploy
 -verb:sync
 -allowUntrusted
 -source:package='src\WebProject\obj\Deploy-Staging\Package\WebProject.zip'
 -dest:auto,ComputerName=
  'https://192.168.0.1:8172/MsDeploy.axd?site=staging.website.com',
  username='staging-deploy',password='xyz',authType='basic',includeAcls='false'
  setParamFile:
    "src\WebProject\obj\Deploy-Staging\Package\WebProject.SetParameters.xml"
 -setParam:name='IIS Web Application Name',value='staging.website.com'
 -enableRule:DoNotDeleteRule
 -disableLink:AppPoolExtension -disableLink:ContentExtension
 -disableLink:CertificateExtension

Hope this helps someone!

这篇关于打破MsBuild包&部署到单独的MsBuild和MsDeploy命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-03 02:44