asp.net-mvc – What is the difference between settings properties<compilation> and<httpRuntime> ?

Question:

I'm having some problems while learning to work with C#, more specifically with Asp Net MVC.

I saw a configuration snippet in Web.config that left me a little confused, namely:

<compilation debug="true" targetFramework="4.6.2"/>
<httpRuntime targetFramework="4.5"/>

As you can see, it seems that each has different targetFramework settings.

I would like to know:

  • What is the difference between compilation and httpRuntime ?
  • What does each of these settings affect in the case of the targetFramework option?

Answer:

As already answered by @Tetsuya Yamamoto in another question, briefly this is it:

The compilation selects which version of the .NET Framework reference assemblies is used when performing the compilation.

And httpRuntime to say the current project is designed to use .NET 4.5 runtime assemblies without recompiling existing project assemblies on the deploying machine before loading it into memory.

The targetFramework in web.config serves to keep compatibility issues between changes from each version of the .NET Framework. And the difference between targetFramework in compilation and httpRuntime belongs to each development and deployment environment.

Scroll to Top
AllEscort