MSBuild发布目标后 [英] MSBuild AfterPublish Target

查看:179
本文介绍了MSBuild发布目标后的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想要一个特定的文件复制到我的web项目的已发布的输出。我尝试将 Build Action 更改为内容并将复制到输出目录始终复制。这个工作很好,除了它在一个子文件夹中与项目中的方式相同。



我不想让它埋在一个子文件夹中。我想要它坐在其他发布的输出旁边。我想我可能会使用 AfterPublish 目标来处理这个问题。



有人可以显示我可以这样做吗?我想我需要知道该人在发布对话框中选择的路径。

解决方案

不幸的是发布功能在Visual Studio本身内埋入深层。因此,您可以在扩展此过程中执行的操作非常有限。因为这是一个简单的任务,因为你在这里概述的是不是真的可能,至少从你的项目文件。如果您需要更好地控制您的Web部署,我建议您查看 Web部署项目和/或 MSDeploy
我将会添加一个Web部署项目,它将准备您的Web应用程序进行部署,包括此自定义文件副本,然后允许MSDeploy为您执行实际部署。


I want a particular file copied in with the published output of my web project. I tried changing the Build Action to Content and changing the Copy to Output Directory to Copy always. This works fine except that it buries it down in a sub folder the same way it is in the project.

I do not want it buried down in a sub folder. I want it sitting right next to the rest of of the published output. I thought I might instead handle this problem using the AfterPublish Target.

Can someone show how I might do this? I think I'd need to know the path that the person selected in the Publish dialog somehow.

解决方案

The Publish feature is unfortunately buried deep inside of Visual Studio itself. Because of this you are very limited in what you can do to extend the process. Because of this even a simple task as you have outlined here is not really possible, at least from your project file. If you need to get better control of your Web Deployments I would suggest that you take a look at Web Deployment Projects and/or MSDeploy. What I would do it add a Web Deployment Project which will prepare your Web App for deployment, including this custom file copy, and then allow MSDeploy to perform the actual deployment for you.

这篇关于MSBuild发布目标后的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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