Paul
Paul

Reputation: 1004

When to Compile and Build and when not for .NET?

I have a couple of general questions regarding when it is necessary to recompile an entire .NET Application: Specifically, what file is ok to simply upload:

  1. I know that any change to the web.config does not require re-compilation, and that file can simply be uploaded to whatever development site.

  2. A change to .css file require re-comipile? Or can I simply upload that file to development site?

  3. A change to .aspx file require re-compile? Or can I simply upload that file to development site?

  4. A change to .cs file require re-compile? I would think yes.

  5. A change to any .js file requires re-compile of application? Or can I simply upload that file to development site?

Upvotes: 1

Views: 2390

Answers (2)

Oded
Oded

Reputation: 499212

Changes to any static resources do not require you to recompile the application - this includes .css, .js, images and such.

Changes to .aspx / .master pages do get a recompilation - but this is done automatically by IIS.

Changes to web.config do not require a recompilation as this is configuration - it simply needs to be reloaded, which IIS will do by recycling the application.

Changes to .cs files will require a recompilation - otherwise the web site dll file will not be up to date if using a web application project. In a web site project, you can use the app_code directory - IIS will automatically recompile it.

Upvotes: 2

jrummell
jrummell

Reputation: 43087

  1. ASP.NET/IIS will restart the application and recompile any .aspx or App_Code files when web.config is changed
  2. .css files are static and do not compile
  3. .aspx files can be pre compiled but don't have to be
  4. Changes to .cs files outside of App_Code require compilation
  5. .js files are static and do not compile

FYI - App_Code only applies to Web Site Projects, Web Application Projects require all .cs file changes to be recompiled

Upvotes: 2

Related Questions