我想为我的网站创建一个部署zip文件。
我需要在部署包中添加一个文件夹,所以我跟着this tutorial(我在项目中添加了.wpp.targets文件)
但是当我使用命令行运行MSBuild时,我收到此错误:
C:\ Program Files (86)\的MSBuild \微软\ VisualStudio的\ V12.0 \网络\ Microsoft.Web.Publishing.targets(3898, 5):msdeploy错误ERROR_EXCEPTION_WHILE_CREATING_OBJECT:Web 部署任务失败。 (对象类型'清单'和路径 ' C:\ MYPROJECT \ MyWebsite \ deploymentfolder \ Website.SourceManifest.xml' 无法创建。
第3898行和之后:
<VSMSDeploy Condition="!$(UseMsdeployExe)"
MSDeployVersionsToTry="$(_MSDeployVersionsToTry)"
Source="@(MsDeploySourceProviderSetting)"
Destination="@(MsDeployDestinationProviderSetting)"
DeploymentTraceLevel="$(PackageTraceLevel)"
DisableLink="$(PackageDisableLinks)"
EnableLink="$(PackageEnableLinks)"
DeclareParameterItems="@(_Package_MsDeployDeclareParameters)"
OptimisticParameterDefaultValue="$(EnableOptimisticParameterDefaultValue)"
ImportDeclareParametersItems="$(_VsPackageParametersFile)"
ReplaceRuleItems="@(MsDeployReplaceRules)"
RetryAttempts="$(RetryAttemptsForDeployment)">
<Output TaskParameter="Result" PropertyName="PackageResult" />
</VSMSDeploy>
我的MSBuild命令:
MSBuild Myproject.sln /P:Configuration="Release" /P:DeployOnBuild="True" /P:Platform="Any CPU" /P:PackageLocation="deploymentfolder/Website.zip" /P:DeployTarget=Package
您是否知道如何修复错误?
我尝试了一个新项目并得到同样的错误......
我希望在我的部署中添加一个文件夹.zip
答案 0 :(得分:0)
好的,我发现了问题。我想添加的floder是空的。出于某种原因,它确实起作用。我在文件夹中添加了文件并且有效...
我终于更改了我的.wpp.targets文件,只需将包含所有文件的文件夹添加到部署中.zip:
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Target Name="CustomCollectFiles">
<ItemGroup>
<CustomFiles Include="MyFolder\**\*" />
<FilesForPackagingFromProject Include="%(CustomFiles.Identity)">
<DestinationRelativePath>MyFolder\%(RecursiveDir)%(Filename)%(Extension)</DestinationRelativePath>
</FilesForPackagingFromProject>
</ItemGroup>
</Target>
<PropertyGroup>
<CopyAllFilesToSingleFolderForPackageDependsOn>
CustomCollectFiles;
$(CopyAllFilesToSingleFolderForPackageDependsOn);
</CopyAllFilesToSingleFolderForPackageDependsOn>
<CopyAllFilesToSingleFolderForMsdeployDependsOn>
CustomCollectFiles;
$(CopyAllFilesToSingleFolderForPackageDependsOn);
</CopyAllFilesToSingleFolderForMsdeployDependsOn>
</PropertyGroup>
</Project>