Share via


Targeting .NET 4.5 with Visual Studio 2010?

Question

Sunday, March 11, 2012 12:01 AM

Is there any way to target .NET 4.5 with VS2010? I installed .NET 4.0.3 yesterday (and it's target) in order to use SqlConnection's new ConnectionID property. Then installed .NET 4.5. However, there seems to be no VS2010 target for it. My 4.0.3 project fails debugging with "can't find a version 4.0.3 on the box, would you like to download it?". Changing the target to 4.0 loses the new property, producing a compile-time error.

Using csc.exe or running the program outside of VS2010 works fine, but having intergration with VS would be nice.

Thanks, Bob

All replies (8)

Sunday, March 11, 2012 4:32 AM | 2 votes

Hi Bob, .NET framework 4.5 is not supported in VS 2010 unfortunately. You will need to use VS 11 to have the option to change the target framework of your solution to .NET framework 4.5.


Sunday, March 11, 2012 4:54 AM

Thanks for the information.

Cheers, Bob


Tuesday, March 13, 2012 6:40 PM

Hi Bob,

Can you help add more repro steps for following as 4.0.3 target should work on VS 2010 SP1 and allow you to build and run apps - if you have correctly installed the design time update (KB2600214).

>>>My 4.0.3 project fails debugging with "can't find a version 4.0.3 on the box, would you like to download it?".

See more details on 4.0.3 here: http://msdn.microsoft.com/en-us/netframework/hh854775.aspx

Download the design time update from here: http://www.microsoft.com/download/en/details.aspx?displaylang=en&id=29054

Thanks,

Vivek Mishra - MSFT

Vivek Mishra - MSFT


Tuesday, March 13, 2012 6:55 PM

Hi Vivek,

There's no steps to be providers. When I installed the 4.0.3 design update, it worked fine.

Then, afterwards, I installed the 4.5 update for .NET (which overwrote the 4.0.3 version of the framework) and now VS, doesn't "see" 4.0.3. Which makes sense, as it was over-written with 4.5. I'm looking to target 4.5. And 4.0.3 design doesn't work. As expected.

Bob


Tuesday, March 13, 2012 7:18 PM

Thanks Bob.

Just to be sure you have installed .NET 4.5 Beta OR .NET 4.5 Developer Preview, so that I can try the right repro? Also, 4.0.3 target in VS 2010 SP1 should continue to show even if you install .NET 4.5 OR Visual Studio 11 Beta.

We already know of an issue with .NET 4.5 Developer Preview when installed on top of 4.0.3, so you will need to install Beta if you want to work with both the framework targets on the same machine.

Yes, Update 4.0.3 design time and Visual Studio 11 Beta (which installs .NET 4.5 Beta) can coexist on the same box and you can build and run apps for them. Even though the framework runtime files are upgraded to 4.5 Beta, all 4.0.3 apps will continue to work as-is on the same box as .NET 4.5 is fully compatible with 4.0.3.

See the KB Article for design time update for more info and the .NET Framework Compatibility section in the MSDN article:

http://support.microsoft.com/kb/2600214

http://msdn.microsoft.com/en-us/netframework/hh854775.aspx

Thanks,

Vivek Mishra - MSFT

Vivek Mishra - MSFT


Tuesday, March 13, 2012 8:06 PM

Yes, it says I have the 4.5 Developer Preview installed. Too bad I didn't know that 4.5 Developer Preview was incompatible with 4.0.3 and 4.5 NET Beta WAS comptible at the time I installed it. To complicate matters, there are also ".NET 4.5 Beta/Previews" out there from Nov 2011, I didn't want that either.

Although the last link you mentioned (http://msdn.microsoft.com/en-us/netframework/hh854775.aspx) says that .NET 4.5 Beta IS compatible with 4.0.3, it doesn't say that 4.5 Developer Preview ISN"T compatible. It would be nice to make this information available with both downloads. And actually, almost all the links on the 4.5 Developer Preview page (http://msdn.microsoft.com/en-us/netframework/hh403373) point to pages that reference .NET 4.5 Beta. Even the one on app compatibility.

The first link is simple about version 4.0.3, I've read that one.

I know this is all compatible with VS2011Beta, but don't have the time or inclination to install the entiety of that right now.

Thanks, Bob


Thursday, August 16, 2012 9:24 AM

Can I use VS2010 Sp1 on a PC which has .net 4.5 installed? Does it give me any improvements (perf, fixed Bugs) compared to .net 4.0?

"A programmer is just a tool which converts caffeine into code"


Tuesday, November 27, 2012 4:53 AM

Hi All,

It is very much clear that we cannot use 4.5 frameowrk with 2010 SP1 . To use 4.5 we have to instal VS 2012.