如何让 MSDeploy 将其他文件发布到 Azure? [英] How do I get MSDeploy to pusblish additional files to Azure?

查看:66
本文介绍了如何让 MSDeploy 将其他文件发布到 Azure?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 ASP.NET Web API 项目,该项目绑定到托管在 tfs.visualstudio.com 上的 TFS 源代码控制存储库和一个持续集成构建(也在 tfs.visualstudio.com 上),它将输出发布到 Azure.CI 构建正确触发,构建输出部署到 Azure,但我希望部署还包括 XML 文档文件,因为它们驱动我的 Web API 项目的帮助页面.

I have an ASP.NET Web API project that is bound to a TFS source control repository hosted on tfs.visualstudio.com and a continuous integration build (also on tfs.visualstudio.com) which publishes the output to Azure. The CI build triggers properly and the build output is deployed to Azure but I want the deployment to also include XML documentation files as they drive the help page of my Web API project.

在谷歌搜索后,我发现了一篇博客文章,表明我应该将以下内容添加到我的 pubxml 文件中:

After doing some Googling, I found a blog post indicating that I should add the following to my pubxml file:

<PropertyGroup>
    <CopyAllFilesToSingleFolderForMsdeployDependsOn>
        CustomCollectFiles;
        $(CopyAllFilesToSingleFolderForMsdeployDependsOn);
    </CopyAllFilesToSingleFolderForMsdeployDependsOn>
</PropertyGroup>
<Target Name="CustomCollectFiles">
    <ItemGroup>
        <_CustomFiles Include="bin\**\*.xml" />
        <FilesForPackagingFromProject Include="%(_CustomFiles.Identity)">
              <DestinationRelativePath>bin\%(RecursiveDir)%(Filename)%(Extension)</DestinationRelativePath>
        </FilesForPackagingFromProject>
     </ItemGroup>
</Target>

如果我从 Visual Studio 2012 手动发布,这会起作用,但当我的 CI 构建发布其输出时不起作用.CI 构建不发布 XML 文档文件.

This works if I manually publish from Visual Studio 2012, but does not work when my CI build publishes its output. The CI build does not publish the XML documentation files.

为什么这在 Team Build 服务器上的行为与在我的开发盒上的行为不同?

Why would this behave differently on the Team Build server than on my development box?

推荐答案

根据 http://blogs.msdn.com/b/aaronhallberg/archive/2007/06/07/preserving-output-directory-structures-在-orcas-team-build.aspx 中,您的团队构建服务器使用 $(OutDir) 来确定文件在构建过程中的位置.在您的开发框中,它通常使用 .proj 文件中的 $(OutputPath).

According to http://blogs.msdn.com/b/aaronhallberg/archive/2007/06/07/preserving-output-directory-structures-in-orcas-team-build.aspx, your Team Build server uses $(OutDir) to determine where the files should go during your build. On your development box, it usually uses $(OutputPath) from the .proj file.

$(OutputPath) 通常是你的项目文件夹下的 bin 文件夹;看起来您已经将 bin(不使用 $(OutputPath) 变量)指向自定义文件的 Include 值.尝试使用类似 $(OutDir)\**\*.xml 之类的东西在构建时获取实际输出路径,而不管环境如何.

$(OutputPath) usually is the bin folder under your project folder; it looks like you've pointed at bin (without using the $(OutputPath) variable) for the Include value for your custom files. Experiment instead with using something like $(OutDir)\**\*.xml to get the actual output path at build time, regardless of environment.

这篇关于如何让 MSDeploy 将其他文件发布到 Azure?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆