MSBuild 包任务 - Web 部署

发布于 2024-09-28 00:52:57 字数 1125 浏览 6 评论 0原文

我正在尝试将自定义文件添加到我们的 Web 部署包中,根据此博客文章:http: //sedodream.com/2010/05/01/WebDeploymentToolMSDeployBuildPackageInclusionExtraFilesOrExducingSpecificFiles.aspx

  <Target Name="CustomCollectFiles">
    <Message Text="AppBuildFolder = $(AppBuildFolder)"/>
    <ItemGroup>
      <_CustomFiles Include="..\*Repository*\**\*.dll;..\*Repository*\**\*.pdb" Condition="'$(AppBuildFolder)' == ''" />
      <_CustomFiles Include="$(AppBuildFolder + '*.dll');$(AppBuildFolder + '*.pdb')" Condition="'$(AppBuildFolder)' != ''" />
      <FilesForPackagingFromProject Include="%(_CustomFiles.Identity)">
        <DestinationRelativePath>bin\%(Filename)%(Extension)</DestinationRelativePath>
      </FilesForPackagingFromProject>
    </ItemGroup>
    <Message Text="Files found: @(_CustomFiles)"/>
  </Target>

我们在 AppBuildFolder 中还有一些其他引用,需要将其复制到包中,但我从未在消息中看到任何输出的文件。有什么想法吗?

谢谢 安迪

I'm trying to add custom files to our web deployment package, per this blog posting: http://sedodream.com/2010/05/01/WebDeploymentToolMSDeployBuildPackageIncludingExtraFilesOrExcludingSpecificFiles.aspx

  <Target Name="CustomCollectFiles">
    <Message Text="AppBuildFolder = $(AppBuildFolder)"/>
    <ItemGroup>
      <_CustomFiles Include="..\*Repository*\**\*.dll;..\*Repository*\**\*.pdb" Condition="'$(AppBuildFolder)' == ''" />
      <_CustomFiles Include="$(AppBuildFolder + '*.dll');$(AppBuildFolder + '*.pdb')" Condition="'$(AppBuildFolder)' != ''" />
      <FilesForPackagingFromProject Include="%(_CustomFiles.Identity)">
        <DestinationRelativePath>bin\%(Filename)%(Extension)</DestinationRelativePath>
      </FilesForPackagingFromProject>
    </ItemGroup>
    <Message Text="Files found: @(_CustomFiles)"/>
  </Target>

We have some other references located at AppBuildFolder that we need copied into the package, but I never see any File found outputted in the message. Any ideas?

Thanks
Andy

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

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

发布评论

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

评论(2

爱格式化 2024-10-05 00:52:57

好吧,问题是这样的。我们正在使用 Nant 的 MsBuild 任务来构建 Web Deploy 项目。

显然,当像这样调用任务时:

<msbuild>
  <property name="AppBuildFolder" value="${Some.Path.Ending.In.Backslash}" />
</msbuild>

MsBuild 最终得到这个值 c:\myfolder"。请注意末尾的双引号,而不是 c:\myfolder\ 因此

解决方法是更改​​ 并使用 元素传递值。

,问题出在 MsBuild 任务上。 NantContrib。

希望这可以节省其他人的时间。

Ok, so the problem was this. We are using Nant's MsBuild task to build the Web Deploy project.

Apparently, when calling the task like this:

<msbuild>
  <property name="AppBuildFolder" value="${Some.Path.Ending.In.Backslash}" />
</msbuild>

MsBuild ends up with this value c:\myfolder". Notice the double quote at the end, instead of c:\myfolder\.

The fix was to change the <property /> and pass the value using the <arg /> element.

So, the problem was the MsBuild task in NantContrib.

Hope this saves somebody else some time.

雅心素梦 2024-10-05 00:52:57

您缺少将该目标注入到构建中的 PropertyGroup。您也应该包括这一点,我怀疑该目标没有执行,因此它们永远不会被添加。另外,您可能想关注我的博客,因为有一个更简单的方法可以做到这一点,当我有时间时我会很快写博客。

You are missing the PropertyGroup that injects that target into the build. You should include that as well, I suspect that this target is not executing so they never get added. Also you might want to keep an eye on my blog because there is a simpler way to do this, I will blog it soon when I have time.

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