简体   繁体   中英

What manifest visual studio is using to generate msdeploy package

I want to package a folder with msdeploy.exe to a zip destination at the end of CI process. I run the following command line

msdeploy.exe -verb:sync -source:contentpath="C:\SampleWebApp" -dest:package="c:\SampleWebApp.zip" -declareParamFile="parameters.xml" 

I also like the *.deploy.cmd and *.SetParameters.xml which msbuild generates when it spits out a deployment package. I renamed the one set of *.deploy.cmd and *.SetParameters.xml file and changed the content accordingly. to be able to run in deployment environment.

When I run *.deploy.cmd file it generates the folder "C:\\SampleWebApp" rather than creating the iis app based on parameters provided in .SetParameter.xml.

After some investigation, I've found that the .cmd deploys to -dest:auto which is good. but apparently my package manifest inside the package indicates that this package is contentPath whereas packages generated by msbuild has more complex manifest in archive.xml inside package using iisApp provider.

Having looked at following post

http://blogs.msdn.com/b/webdev/archive/2013/01/09/real-scenario-folder-deployment-scenarios-with-msdeploy.aspx

I believe if I use -source:manifest="Package.xml" with right Package.xml the end result should be similar to VS package output

The I thought maybe the *.SourceManifest.xml is the manifest for the package. I used and it builds the package but when I want to deploy that to the using .deploy.cmd it complains about setAclUser

Error: A value for the 'setAclUser' setting must be specified when the 'setAcl' provider is used with a physical path.

Does anybody know that is the manifest msbuild uses?

To directly answer your question: the manifest is generated dynamically based on MsDeploySourceManifest MSBuild items.

You can make it use contentPath rather than iisApp by declaring DeployAsIisApp=false in your publish profile (or command line /p:DeployAsIisApp=false ). This will also disable the setAcl providers.

If you want to keep iisApp , you can disable the ACL providers...

  1. ... being added to the package by declaring IncludeSetAclProviderOnDestination=false in your publish profile
  2. ... being deployed by passing /I:False to deploy.cmd

Following is the manifest template

<?xml version="1.0" encoding="utf-8"?>
<sitemanifest>
  <iisApp path="[PATH1]"/>
</sitemanifest>

and Parameter.xml template

<parameters>
  <parameter name="IIS Web Application Name" defaultValue="WEBSITENAME" tags="IisApp">
    <parameterEntry kind="ProviderPath" scope="IisApp" match="^[PATH1ESCAPED]$" />
  </parameter>
  <!-- appSetting section-->
</parameters>

note: [PATH1] should be replaced with your folder path like C:\\MY.FOLDER\\WWW and [PATH1ESCAPED] should be same path but escaped with postfix and prefix ^ $ like ^C:\\MY.FOLDER\\WWW$

Then you can call

"C:\Program Files\IIS\Microsoft Web Deploy V3\msdeploy.exe" -verb:sync -source:manifest="Manifest.xml" -dest:package=%1 -declareParamFile="parameters.xml" 

and %1 being folder path like C:\\MY.FOLDER\\WWW

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM