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 unzip it, modify some files and then zip it again and try to deploy using msdeploy.
The problem is, that it deploys empty folder. When I try to deploy unmodified .zip package - it works fine.
After long hours digging, I figured out, that msdeploy does not support packages, which were zipped using other than built in windows zip archiver.
How to zip files using windows zip archiver in C#/F#? I've tried using System.IO.Compression.ZipFile.CreateFromDirectory
method, but msdeploy still deploys empty folders.
Here's the warning what I get, when trying to deploy package:
Warning: Skipping source dirPath (C:\TeamCity\buildAgent\MyPath) because of rule SkipInvalidSource.
The Zip package 'C:\TeamCity\buildAgent\MyPath\MyPackage.zip' could not be loaded.
When I disable SkipInvalidSource
rule, I get the following error:
Error: (12/23/2014 6:56:44 PM) An error occurred when the request was processed on the remote computer.
Error: Object reference not set to an instance of an object.
at Microsoft.Web.Deployment.DeploymentSyncEnumerable.<Create>d__0.MoveNext()
at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
at Microsoft.Web.Deployment.DeploymentSyncContext.SyncChildrenNoOrder(DeploymentObject dest, DeploymentObject source)
at Microsoft.Web.Deployment.DeploymentSyncContext.SyncChildrenNoOrder(DeploymentObject dest, DeploymentObject source)
at Microsoft.Web.Deployment.DeploymentSyncContext.SyncChildrenOrder(DeploymentObject dest, DeploymentObject source)
at Microsoft.Web.Deployment.DeploymentSyncContext.ProcessSync(DeploymentObject destinationObject, DeploymentObject sourceObject)
at Microsoft.Web.Deployment.DeploymentObject.SyncToInternal(DeploymentObject destObject, DeploymentSyncOptions syncOptions, PayloadTable payloadTable, ContentRootTable contentRootTable, Nullable`1 syncPassId, String syncSessionId) at Microsoft.Web.Deployment.DeploymentAgent.HandleSync(DeploymentAgentAsyncData asyncData, Nullable`1 passId)
Error count: 1.
Any ideas how to zip and deploy project correctly?
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
toArchive 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 :
For more info look at help:
and other. Also, see parameters.xml