如何从命令行发布 ASP.NET MVC 项目?
我有一个现有的网站,用于监视 SVN 存储库的更改,当签入时,使用 aspnet_compiler 构建新网站,然后将生产网站上的内容通过 sftp 传输到生产环境网络服务器。 整个持续集成流程是使用cruisecontrol.net构建的。
我已经重构了整个站点以使用 ASP.NET MVC,现在我正在尝试集成到我的构建过程中。 看来这已经改变了,我没有得到与以前的 MVC 站点相同的行为。 不幸的是,我没有取得太大进展,因为似乎还没有人做到这一点。 有没有人有这样的东西以任何形式工作?
像“常规项目”一样使用“devenv”自动化命令行也不起作用。 有 /Build 命令行开关,但它们只是就地构建。 此命令行不会公开 UI 中内置的“发布”机制。 项目目录中甚至有一个 {Project Name}.Publish.xml 文件,它似乎是需要发布的内容的清单。 只是没有办法自动化。
我只是想从命令行模拟 VS 2008 MVC 项目中构建菜单下的“Publish {Project name}”。
I've got an existing web site that monitors an SVN repository for changes and when there is a check in, the new web site is built using aspnet_compiler and then a diff of what is on the production site is sftp'd up to a production web server. The entire continuous integration process is built using cruisecontrol.net.
I've refactored the entire site to use ASP.NET MVC and I am now trying to integrate into my build process. It seems that this has changed and I am not getting the same behavior as I used to get with a pre-MVC site. I'm unfortunately not making much progress because it seems that no one has done this yet. Has anyone got something like this to work in any form at all?
Automating the command line using "devenv" like a "regular project" does not work either. There are /Build command line switches but they just build in place. This command line does not expose the "Publish" mechanism that is built into the UI. There is even a {Project Name}.Publish.xml file in the project directory that seems like it is a manifest of what needs to be published. Just no way of automating that.
I'm just trying to emulate the "Publish {Project name}" under the build menu in VS 2008 MVC project from the command line.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果您使用 CruiseControl.net,则您已经完成了 85% 的工作。 你能使用 NAnt 吗? 这绝对是正确的选择。
如果没有,那么我会考虑使用命令中的 msbuild line 而不是 devenv 因为它不是为了做你想做的事情而设计的。
NAnt 绝对是一个很好的选择。 不过,尽管他们对 msbuild 进行了所有更改,但它无疑是一个强有力的竞争者。 南特最近刚刚获得了新的生命,所以它应该仍然是一个很好的选择。
If you're using CruiseControl.net, you're 85% of the way to doing this. Are you able to use NAnt? That would definitely be the way to go.
If not, then I'd look into using msbuild from the command line rather than devenv as that wasn't designed to do what you want.
NAnt is definitely a great way to go. Though, with all the changes they've made to msbuild, it is certainly a great contender. Nant just recently got new life breathed back into it, so it should continue to be an excellent option.
当您创建 MVC 项目时,这是一个标准的 .net 项目,而不是“Web 项目”,它们不是一回事。 我认为 aspnet_compiler 仅适用于 Web 项目,所以也许这就是导致您出现问题的原因。 我不知道您正在使用哪种构建工具,但请尝试像任何其他 .net 项目一样构建它。
When you create a MVC project this is a standard .net project and not a "web project", which are not the same thing. I think that aspnet_compiler is only for web projects, so maybe this is what is causing you problems. I don't know which build tool you are using, but try building it like any other .net project.