Did you know you can use most of the new C# 3.0 language features in VS2008 under a project that’s targeted at .NET 2.0? How cool is that? And it makes sense, too, since there’s nothing new for the 2.0 runtime, it’s all compiler magic. I found it by accident - I found Daniel Moth’s post after the fact - I typed “prop” to access the snippet for generating a property. In VS2008, that snippet generates an Automatic Property by default.
I can’t decide whether this post should be categorized as a tip/trick or a warning, though. It’s both, probably.
In many development environments you won’t care - if you upgrade to Visual Studio 2008 then your build environment is upgraded also. But in some places, such as my company, we have large code bases that span many different technologies, and we have a specially created build system to handle all that. It uses specific compilers - VS7.1 for C++, for example, and the .NET 2.0 SDK compiler for C#.
You can use Visual Studio 2008 for Visual Studio 2005 project files, and with multi-targeting, you can use it in a .NET 2.0 environment. So, back to me as an example, I can transparently use VS2008 as my new IDE of choice - on my local machine. That means when I build from VS2008 locally, the new C# 3.0 language features will work seamlessly, but will fail when our automated builds pick up my changes.
Thus the warning - if you’re not careful (if you’re on “autopilot”) you can write code that will compile in the IDE but not with an SDK.
So, use VS2008, and be careful.
In my case, I always build from the command line anyway - that way I know that what I check in will build everywhere.
I did have a note to myself to get the .NET 3.5 SDK integrated into our build system, but I see that a stand-alone version doesn’t exist - it’s being rolled into the Windows SDK which would have far too wide an impact. <sigh>


Leave a comment