如何发布ASP。NET MVC项目来自命令行吗?

时间:2020-12-10 01:44:31

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.

我有一个现有的web站点,它监视SVN存储库的更改,当有一个check in时,新的web站点是使用aspnet_compiler构建的,然后生产站点上的一小部分内容是sftp,直到生产web服务器。整个持续集成过程是使用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?

我已经重构了整个站点以使用ASP。NET MVC和我现在正在尝试集成到我的构建过程中。这似乎已经发生了变化,我的行为和以前的mvc网站没有什么相同之处。不幸的是,我没有取得多大进展,因为似乎还没有人这么做。有没有人得到这样的东西来做任何形式的工作?

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.

像“常规项目”一样使用“devenv”自动化命令行也不起作用。有/构建命令行开关,但它们只是构建在适当的位置上。此命令行不公开内置在UI中的“发布”机制。甚至还有一个{Project Name}. publish。项目目录中的xml文件,它似乎是需要发布的内容的清单。这是无法自动化的。

I'm just trying to emulate the "Publish {Project name}" under the build menu in VS 2008 MVC project from the command line.

我只是试图从命令行模拟VS 2008 MVC项目中的build菜单下的“Publish {Project name}”。

2 个解决方案

#1


1  

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.

如果您正在使用CruiseControl.net,那么您就完成了85%的操作。你能使用NAnt吗?那绝对是我们该走的路。

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.

如果没有,那么我将考虑使用命令行中的msbuild而不是devenv,因为它不是设计来实现您想要的功能的。

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.

很明显,南特是一个很好的选择。尽管他们对msbuild进行了所有的修改,但它无疑是一个很好的竞争者。田南特最近刚刚恢复了新的生命,因此它应该继续是一个很好的选择。

#2


-1  

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.

当您创建MVC项目时,这是一个标准的。net项目,而不是一个“web项目”,这不是一回事。我认为aspnet_compiler只用于web项目,所以这可能是导致问题的原因。我不知道您使用的是哪种构建工具,但是尝试像任何其他。net项目一样构建它。

#1


1  

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.

如果您正在使用CruiseControl.net,那么您就完成了85%的操作。你能使用NAnt吗?那绝对是我们该走的路。

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.

如果没有,那么我将考虑使用命令行中的msbuild而不是devenv,因为它不是设计来实现您想要的功能的。

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.

很明显,南特是一个很好的选择。尽管他们对msbuild进行了所有的修改,但它无疑是一个很好的竞争者。田南特最近刚刚恢复了新的生命,因此它应该继续是一个很好的选择。

#2


-1  

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.

当您创建MVC项目时,这是一个标准的。net项目,而不是一个“web项目”,这不是一回事。我认为aspnet_compiler只用于web项目,所以这可能是导致问题的原因。我不知道您使用的是哪种构建工具,但是尝试像任何其他。net项目一样构建它。