views:

334

answers:

4

I know I can just copy all of my files from my development environment into my live website directory, but then I know I'm copying several files that aren't necessary (e.g. the .sln file and .csproj files).

What files actually have to be copied for ASP.NET MVC web applications to run? (E.g. Do I need to copy all .CS files?)

+6  A: 

You can use the Build > Publish option (when you're in the context of an ASP.NET MVC project) and publish it directly.

If you cannot use this and have to do a copy all you need is anything that ISN'T a .cs file (views, .config files etc) and your compiled ASP.NET MVC site's .dll (ex MvcApplication1.dll). If you want to get an idea of what you need use the Build > Publish tool to a local directory and take a look at what's in there.

You don't need solution or project files.

Chad Moran
+2  A: 

After you compile your project, you shouldn't copy all .cs files.

Take a look at this link.

J.W.
A: 

Basically everything but the views get compiled into a dll. You can use the deploy option to see what you need to deploy ;).

Morph
+2  A: 

Using the Build / Publish approach is the best to ensure you have the files you need. Before building though, if you don't have ASP.NET 3.5 SP1 installed on your server, make sure you go into the references in your project for the following assemblies and set the to "Copy Local" in each of their respective property pages.

System.Web.MVC System.Web.Routing System.Web.Abstractions

This will make sure that each of these assemblies is copied to your "bin" folder on the published site.

Brian

Brian Behm