Earlier I was building and deploying web project using msbuild.exe
Now I want to modify some files before deploying, so I make a .zip package using msbuild, then unz
Dan Kendall's answer helped me but in the end I didn't need to use 7Zip. I prefer this way because then I don't need to install 7Zip on the build server.
The answer was simple, I just switched from using Zip to Archive Files
I had this exact problem. I've got a bunch of msdeploy packages and need to update some of the files post-packaging but pre-deploy.
If I use msdeploy sync to extract the packages, the parameters get processed - that's no good, they're just placeholders until I know which environment is being targeted. So I need to unzip the package and then make the changes...so far so good.
But then I rezip it all up. And then then I get this issue: msdeploy won't process the contained folders. If I use msdeploy to process the extracted files, again I lose the parameters...or rather they get processed prematurely from the paramters.xml file. Grr.
The solution? Use 7zip...or anything apart from standard Windows zipper.
e.g.
7z.exe a -r C:\deploys\mypackage.zip C:\extractedstuff\*
Don't use zip archiver. You must call msdeploy.exe.
bat-file example :
msdeploy.exe -verb:sync ^
-source:archiveDir="C:\YourAbsolutePathToTheFolderContaining_Content_DirAnd_XMLs" ^
-dest:package="ArchName.zip" ^
-declareParam:name="IIS Web Application Name",defaultValue="Default Web Site/AppName",tags="IisApp" ^
-declareParam:name="IIS Web Application Name",type="ProviderPath",scope="IisApp",match="^.*PackageTmp$" ^
-declareParam:name="IIS Web Application Name",type="ProviderPath",scope="setAcl",match="^.*PackageTmp$"
For more info look at help:
msdeploy -help -dest
msdeploy -help -declareParam
and other. Also, see parameters.xml