MSBuild AfterPublish 目标
我想要将一个特定文件与我的网络项目的已发布输出一起复制。我尝试将构建操作
更改为内容
并将复制到输出目录
更改为始终复制
。这工作得很好,只是它将它埋在子文件夹中,就像在项目中一样。
我不希望它埋在子文件夹中。我希望它位于已发布输出的其余部分旁边。我想我可以使用 AfterPublish
Target 来处理这个问题。
有人可以告诉我如何做到这一点吗?我想我需要以某种方式知道该人在“发布”对话框中选择的路径。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
不幸的是,发布功能被深深地埋藏在 Visual Studio 本身的内部。因此,您在扩展流程方面可以做的事情非常有限。因此,即使是您在此处概述的简单任务也实际上是不可能的,至少从您的项目文件来看是这样。如果您需要更好地控制 Web 部署,我建议您查看 Web 部署项目 和/或 MSDeploy 。
我要做的就是添加一个 Web 部署项目,该项目将为您的 Web 应用程序部署做好准备,包括此自定义文件副本,然后允许 MSDeploy 为您执行实际部署。
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.