之前我使用msbuild.exe构建和部署Web项目。
现在我想在部署之前修改一些文件,所以我使用msbuild制作了一个.zip包,然后解压它,修改一些文件,再次压缩它,尝试使用msdeploy进行部署。
问题是,它会部署一个空文件夹。当我尝试部署未修改的.zip包时,它可以正常工作。
经过长时间的挖掘,我发现,msdeploy不支持使用内置Windows zip存档程序以外的其他程序压缩的软件包。
如何在C# / F#中使用Windows zip存档程序压缩文件?我尝试使用System.IO.Compression.ZipFile.CreateFromDirectory
方法,但是msdeploy仍然会部署空文件夹。
这是我在尝试部署软件包时收到的警告:
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.
当我禁用
SkipInvalidSource
规则时,我会得到以下错误: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.
有没有什么想法可以正确地压缩和部署项目?
-dest:contentPath
部署了整个目录,而不是压缩包。 - user4228370