views:

445

answers:

4

Hi,

I want to deploy my web application (asp.net mvc), and I need to remove all the codebehind files from my project.

Any scripts that you guys know of to do this?

I prefer using a script since I can tweak it if need be.

+1  A: 

Just select the publish web site option on your project and it should take care of that (if you use vs).

Menu Build/Publish Website

AlbertEin
+1  A: 

In Visual Sudio, right click your project and select Publish... in the appearing dialog, select "Only files needed, to run this application".

The Publishing wizard will compile all codebehind files to your assembly and remove them for publishing.

Johannes Hädrich
I'm looking for a script, so I can tweak it.
public static
A: 

I'd recommend using a web deployment project. This will compile your website and copy all of the files needed to for deployment into a new folder (without code-behind files, as they don't need to be deployed). You also get a little more control this way, as you can set up pre-build and post-build events.

For instance, I've set up a post-build event on the web deployment project to execute a batch file which copies some files into the Debug/Release folder and then zips it up, ready for FTP'ing to the production server.

Mun
A: 

First, codebehind files are not recommended for ASP.NET MVC. Codebehind is the controller for ASP.NET standard files - but in ASP.NET MVC you have far more powerful controllers.

Second, why do you need to remove codebehind files? IIS / MVC / Web.config should be taking care of ensuring that *.cs etc. files do not get served and result in a 404.

Justice