MSBUILD Web 部署包不包含项目引用 DLL

发布于 2024-11-29 04:19:11 字数 1668 浏览 6 评论 0原文

当我尝试使用 msbuild 创建用于 Web 部署的包时,它仅包含项目 dll。包 zip 文件或临时目录不包含引用项目的 dll。

我看过这篇文章 这不是我的问题。我肯定使用了我正在为其创建部署包的主项目中引用的项目中的代码。

我正在使用 MSBUILD 4 创建包。

当我使用 VS2010 使用完全相同的项目文件创建包时,它工作正常。所有引用的项目的 dll 都包含在 package.zip 文件中。

我尝试更改 _PackageTempDir 的位置,但这也没有解决问题。

我尝试取出 ExcludeFilesFromDeployment 属性并将 PackageAsSingleFile 设置设置为 false 以查看是否会更改结果。

这是我的包目标。所有正则表达式都是为了让我可以从搜索路径的末尾提取项目文件名,然后使用该名称作为输出文件夹的名称和 zip 文件的名称。 PackageOutputDir 是我正在导入的一个属性。

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

关于为什么它不包括我引用的项目 dll 有什么想法吗?

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

溺深海 2024-12-06 04:19:11

您可以在 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>

在调用 msbuild 的地方,您需要添加一个将在 $(PackageProjectName) 中使用的属性,方法如下:

msbuild.exe /property:PackageProjectName=$project

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文