How to force Visual Studio to use .Net 2.0 compiler?
The build machine where I work still uses the .Net 2.0 compiler.
I've set up Visual Studio to target the .Net Framework 2.0, but when I use the keyword var
, it's 开发者_如何学运维compiling (since the compiler automagically change the type). But it breaks on the build machine compiler.
Is there a way to setup Visual Studio to break on those things, or even force it to use the 2.0 compiler, so that I won't make the mistake to break the build by using "too new" functionalities?
If I remember correctly, each version of .Net was tied to a specific version of DevStudio and it isn't possible to change this. If you need to compile for .Net 2 then you need the VS2005 compiler. One way to solve this is to use makefiles rather than the IDE to build the application and specify explicitly which compiler is used for each file.
精彩评论