Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MSBUILD web deploy package does not include the project reference DLL's

When I try to create a package for web deploy using msbuild it only includes the projects dll. The package zip file or the temp directory does not include the referenced project's dlls.

I've looked at this post and that is not my problem. I am definitely using the code from the referenced projects in my main project that I'm creating the deployment package for.

I'm using MSBUILD 4 to create the package.

When I create the package using VS2010 using the exact same project file it works fine. All the referenced projects have their dlls included in the package.zip file.

I've tried changing the location of the _PackageTempDir and that did not solve the problem either.

I've tried taking out the ExcludeFilesFromDeployment property and set the PackageAsSingleFile setting to false to see if that would change the results.

Here is my target for Package. All the regex is so I can pull my project file name off the end of a search path and then use that name for the name of the output folder and the name of the zip file. The PackageOutputDir is a propertyI am importing.

  <Target Name="Package">
    <MSBuild Projects="@(PackageProject)" Targets="Package" Properties="Platform=$(Platform);
                                                                           Configuration=$(Configuration);
                                                                           DeployOnBuild=true;
                                                                           DeployTarget=Package;
                                       PackageLocation=$(PackageOutputDir)\$([System.Text.RegularExpressions.Regex]::Split($(ProjectName), '(.*\\)([a-z,A-Z,0-9,_,-]+)(\.\*proj;)')[2])\$([System.Text.RegularExpressions.Regex]::Split($(ProjectName), '(.*\\)([a-z,A-Z,0-9,_,-]+)(\.\*proj;)')[2]).zip;
                                       PackageAsSingleFile=true;
                                       ExcludeFilesFromDeployment=Web.config;
                                       _PackageTempDir=$(PackageOutputDir)\temp;">
    </MSBuild>
  </Target>

Any ideas as to why it is not including my referenced project dlls?

like image 824
Ben Anderson Avatar asked Aug 11 '11 19:08

Ben Anderson


1 Answers

You could do the following in your MasterBuild.proj.

  <Target Name="Package">
    <ConvertToAbsolutePath Paths="$(PackageOutputDir)">
      <Output TaskParameter="AbsolutePaths" PropertyName="Source_Dir_Abs"/>
    </ConvertToAbsolutePath>
   <MSBuild Projects="@(PackageProject)" Targets="Package"
      properties="Platform=$(Platform);
      Configuration=$(Configuration);
      DeployOnBuild=false;
      DeployTarget=Package;
      PackageLocation=$(Source_Dir_Abs)\$(PackageProjectName).zip;
      PackageAsSingleFile=true;
      ExcludeFilesFromDeployment=Web.config;
      _PackageTempDir=$(PackageOutputDir)\temp;">
  </MSBuild>
  </Target>

Where you are calling msbuild you will need to add a property that will be used in $(PackageProjectName) by doing the following:

msbuild.exe /property:PackageProjectName=$project

like image 66
Mark Avatar answered Sep 28 '22 05:09

Mark