MsDeploySkipRules in wpp.targets not working with PublishProfiles

一个人想着一个人 提交于 2019-12-04 12:48:06
nekno

(1) The AbsolutePath value in your example is copy/pasted from my skip rule example. You need to change that value to the path of your Downloads folder.

  <Target Name="AddCustomSkipRules">
    <Message Text="Adding Custom Skip Rules" />
    <ItemGroup>
      <MsDeploySkipRules Include="SkipDownloadsFolder">
        <SkipAction>Delete</SkipAction>
        <ObjectName>filePath</ObjectName>
        <AbsolutePath>Downloads</AbsolutePath>
      </MsDeploySkipRules>
    </ItemGroup>
  </Target>

(2) You cannot use a custom skip rule when publishing from within Visual Studio. You must publish using MSBuild from a command prompt. The nature of my question was about combining the convenience of the publishing profile managed within VS, with the utility of a custom skip rule (which requires the command line), because as of VS 2012 Update 3, the limitation of the command line has not been lifted.

My MSBuild command looks like this:

C:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe My.Website.sln /p:Configuration=Release;DeployOnBuild=true;PublishProfile="Test Server - Web Deploy"

If I attempt to publish from within VS 2012, I get the following error, even though "-verb:sync" is clearly visible in the output:

2>Start Web Deploy Publish the Application/package to http://my.website.example.com/MSDEPLOYAGENTSERVICE ...
2>C:\Program Files (x86)\IIS\Microsoft Web Deploy V3\msdeploy.exe 
  -source:manifest='C:\inetpub\wwwroot\My.Website\obj\Release\Package\My.Website.SourceManifest.xml' 
  -dest:auto,ComputerName='http://my.website.example.com/MSDEPLOYAGENTSERVICE',UserName='...',Password="...",IncludeAcls='False',AuthType='NTLM' 
  -verb:sync 
  -disableLink:AppPoolExtension 
  -disableLink:ContentExtension 
  -disableLink:CertificateExtension 
  -skip:skipaction='Delete',objectname='filePath',absolutepath='ErrorLog' 
  -skip:objectname='dirPath',absolutepath='obj\\Release\\Package\\PackageTmp\\App_Data$' 
  -skip:objectname='dirPath',absolutepath='MyWebsite/\\App_Data$' 
  -setParamFile:"C:\inetpub\wwwroot\My.Website\obj\Release\Package\My.Website.Publish.Parameters.xml" 
  -retryAttempts=2 
2>MSDEPLOY(0,0): Error : The verb must be specified by using the -verb argument.
2>MSDEPLOY(0,0): Error count: 1.
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!