MSBuild AfterPublish 目标

发布于 2024-08-13 06:59:57 字数 290 浏览 5 评论 0原文

我想要将一个特定文件与我的网络项目的已发布输出一起复制。我尝试将构建操作更改为内容并将复制到输出目录更改为始终复制。这工作得很好,只是它将它埋在子文件夹中,就像在项目中一样。

我不希望它埋在子文件夹中。我希望它位于已发布输出的其余部分旁边。我想我可以使用 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 技术交流群。

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

发布评论

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

评论(1

樱桃奶球 2024-08-20 06:59:57

不幸的是,发布功能被深深地埋藏在 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.

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