将网站部署程序包构建为构建后事件

编程入门 行业动态 更新时间:2024-10-26 22:18:38
本文介绍了将网站部署程序包构建为构建后事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我正在使用Visual Studio2010.我有一个网站项目,每次构建项目时,我都希望构建一个网站部署程序包.基本上,我正在寻找一个生成MSBuild命令的示例,该命令基本上与网站的右键菜单中的生成部署包"选项具有相同的作用.

I am using visual studio 2010. I have a website project that I would like to build a website deployment package every time I build a the project. Basically I am looking for some example of a post build MSBuild command that will basically do the same thing as the "Build Deployment Package" option from the right click menu of the website.

推荐答案

我假定您正在使用Web应用程序项目,因为Web站点项目没有构建部署包".

I assume you are using Web Application Projects, because Web Site projects do not have the "Build Deployment Package".

我建议不要在每个版本上都执行一个软件包,因为它会大大减慢您的开发速度.话虽这么说,您可以在这里做到这一点.

I would recommend not performing a package on every build, because it will slow down your development drastically. With that being said, you can do it here is how.

如果您真的想要做到这一点,最好的选择不是使用构建后事件,而是编辑项目文件并扩展构建过程.为此,请为您的网站打开.csproj文件,然后将其放置在底部(在Import元素之后的 处)

If you really wanted to do this your best bet is not to use post-build event, but to edit the project file and extend the build process. To do this open the .csproj file for your web and then towards the bottom (after the Import elements) place the following

<PropertyGroup> <BuildDependsOn> $(BuildDependsOn); Package </BuildDependsOn> </PropertyGroup>

这是为了扩展构建过程以调用 Package 目标.这是在Visual Studio中调用构建部署包"目标时所调用的目标.

What this does is extend the build process to call the Package target. This is the same target that is called when you invoke the "Build Deployment Package" target in Visual Studio.

更多推荐

将网站部署程序包构建为构建后事件

本文发布于:2023-11-03 01:20:24,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1553897.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:事件   程序包   网站

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!