2

Can I use the Copy Web Site tool in Visual Studio 2008 to deploy MVC application to my hosting server? However, the Web Site menu doesn't even show up in Visual Studio with MVC project opened. What's the best practice to deploy MVC application? Thanks.

4 Answers 4

11

ASP.NET MVC isn't a web site it's a Web application. You need to Deploy it, or just build it then copy it.

Also depending on your hosting company, they may not have the System.Web.MVC assembly available to you.

So you'll need to deploy that as well in your bin directory. You can get it there by going to references, selecting System.Web.MVC. Right click -? Properties. Then Copy Locally.

EDIT: [Including extra comments from below just in case anyone misses it] you need to do an extra step prior publishing the web application. You need to set the copy local attribute to true to the following references System.Web.Mvc, System.Web.Routing and System.Web.Abstractions. If you want you can go directly to the official documentation.

Sign up to request clarification or add additional context in comments.

3 Comments

+1 was going to add that. but may as well consolidate this answer. might add that wildcarding may need to be turned on for site if hosting is using IIS6
Also, for an explanation of the differences between a "web site" and a "web application", see: stackoverflow.com/questions/398037/…
You need to reference more than one assembly. They also have an attribute called copy local that saves you from having to manually copy assemblies to your bin folder. Please see my comment in dove's answer, which I also believe is the best one for this question.
1

Right click, publish. If you want the very very simple answer.

The best practice is a very wide question that takes in build scripts, tests, etc.....

2 Comments

Adding to your "simple" answer, you need to do an extra step prior publishing the web application. You need to set the copy local attribute to true to the following references System.Web.Mvc, System.Web.Routing and System.Web.Abstractions. If you want you can go directly to the official documentation. msdn.microsoft.com/en-us/library/dd410407.aspx
@Raul correct, however i'm bowing out to JackM's answer above, who notes this. thanks though.
1

Best practice is definitely to have a build script that automates the building, testing and deployment process so all you have to do is run a batch file or command to run the whole thing. We do that very successfully here using NAnt to build, test, check code coverage and deploy to test environment and production environment.

It saves an incredible amount of time not having to remember what files need copied, where they go and what configuration changes need made once deployed.

Comments

0

I'm very happy using the now RTW Web Deployment Tool (http://www.iis.net/extensions/WebDeploymentTool). From Visual Studio 2008 I Publish the web application locally to stage the content and then use the Web Deployment Tool to synchronize with the host server.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.