We're excited at the prospect of upgrading our development IDE from Visual Studio 2008 to 2010. Our production environment, however, is not scheduled to be upgraded from .net 3.5 sp1 to .net 4.0 in the n开发者_如何学JAVAear future.
What are the possible risks in using Visual Studio 2010 to develop production grade applications that will actually run on .net 3.5 sp1 ?
Only a few minor problem I'm aware of. A new C# project created in VS2010 will have a dependency on Microsoft.CSharp.dll, the runtime support assembly for the new "dynamic" keyword. When you change the target framework version to 3.5, you'll get a warning about this assembly, you have to remove it by hand.
Also, your code will be compiled by the new C# 4.0 compiler, even if you target an earlier version of the framework. That could be the source of a compat problem, code that compiles differently with the 3.0 compiler. The more common compat issue is code that shouldn't compile in 3.0 but did because of a compiler bug. Not a real problem of course, but could byte if you check in code that was written by team members that still use 3.0
You can force the compiler to verify that no new 4.0 features are used accidentally with Project + Properties, Build tab, scroll down/right, Advanced, Language Version = "C# 3.0".
If you want to be sure then wait another couple of months and keep an eye on the feedback at connect.microsoft.com.
IMO there really aren't any credible risks IMO. I guess you could say that the risk is that someone on your team may accidentally upgrade your projects to 4.0, but then again, that's what the "svn revert" command is for. :)
You might, however, find that if you run a build server, you will have to upgrade your framework version on it, since your MSBuild copy on your build server won't recognize your VS 2010 project files. But the newer version of MSBuild has no problems back-targeting to 3.5 apps that I've seen.
Targeting 3.5 (or 3.0 or 2.0) is still possible, as in vs 2008. I guess the same risk existed there if you were developing for 2.0 but used 3.0 or 3.5 features by mistake.
My advice is to go for it - we're in the same boat and it's working fine so far.
精彩评论