1

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.

4 Answers 4

1

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

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

Comments

1

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.

1 Comment

I'm looking for a script, so I can tweak it.
0

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.

Comments

0

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.

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.