0
votes

I want to create a deployment zip file for my website.

I needed to add a folder to the deployment package so I followed this tutorial (I added a .wpp.targets file to my project)

But when I run MSBuild with command line, I get this error :

C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v12.0\Web\Microsoft.Web.Publishing.targets(3898, 5): msdeploy error ERROR_EXCEPTION_WHILE_CREATING_OBJECT: Web deployment task failed. (Object of type 'manifest' and path 'C:\Myproject\MyWebsite\deploymentfolder\Website.SourceManifest.xml' cannot be created.

The line 3898 and after :

 <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>

My MSBuild command :

MSBuild Myproject.sln /P:Configuration="Release" /P:DeployOnBuild="True"  /P:Platform="Any CPU" /P:PackageLocation="deploymentfolder/Website.zip" /P:DeployTarget=Package 

Do you have an idea how to fix the error ?

I tried with a new project and get the same error...

I juste want to add a folder to my deployment .zip

1

1 Answers

0
votes

Ok I found the problem. The floder I wanted to add was empty. For some reason, it does'nt work. I added files in the folder and it works...

And I finally changed my .wpp.targets file, to simply add a folder with all files into the deployment .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>