MSBuild AfterPublish Target

天大地大妈咪最大 提交于 2019-12-11 04:49:33

问题


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.


回答1:


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.



来源:https://stackoverflow.com/questions/1828564/msbuild-afterpublish-target

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!