开发者

How to force Visual Studio to use .Net 2.0 compiler?

开发者 https://www.devze.com 2023-03-30 14:54 出处:网络
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 t

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消