Compiler Version and .NET Framework Version - ASP.NET Application Script

Scenario:

I have VS 2010 (C # 4 compiler) focused on 3.5 on my client machine.

I am developing ASP.NET applications. I use optional parameters (supported by C # 4) in the class file and compile the code, everything works fine.

Later, a problem was discovered in Runtime, which uses the old (classic version) ASPX function. No function accepts only the arguments x, where x is less than an optional parameter, this is a run-time error.

Does this mean ordinary classes and such use of the C # compiler for the client, while views (aspx) use the compiler on the server, which causes problems if C # 4 is used in view / form files?

+5
source share
1 answer

I believe this is due to the fact that ASPX (re?) Pages were compiled the first time IIS was loaded, and not compiled in Visual Studio. This allows them to be updated on the fly without recompilation, however, since they are compiled by IIS, this leads to the complications you see.

I do not know how to use IIS for the C # 4 compiler, but compile it in .NET 3.5, so your options are:

  • Upgrade to .NET 4
  • Do not use additional parameters
  • Do not call code that uses optional parameters in your .aspx files. I assume that if you move the calls to the codebehind file, it should work fine, but I have not tried.
+3

All Articles