-
February 2nd, 2011, 02:01 PM
#1
Upgrading from .NET 2 to .NET 4
I have VS 2005 and .NET 2 on my computer.
I downloaded .NET 4 from the MS website.
In C:\Windows\Microsoft.NET\Framework, I now have folders for several versions of .NET, including v2.0.50727 and v4.0.30319.
In C:\Program Files\Microsoft Visual Studio 8\Common7\Tools\vsvars32.bat, I updated the FrameworkVersion and paths from v2.0.50727 to v4.0.30319.
Now when I open VS and look in the object browser, all the paths still point to C:\Windows\Microsoft.NET\Framework\v2.0.50727.
I opened the Project\Add Reference... menu. All the components have a runtime of v2.0.50727 or lower.
I built a new test app, and looked at the manifest with ildasm. It shows
Code:
// Metadata version: v2.0.50727
What do I need to do to use .NET 4?
-
February 3rd, 2011, 08:23 AM
#2
Re: Upgrading from .NET 2 to .NET 4
Go into the Project Properties > Application > Target Framework. You should be able to set what max framework you want to work with.
-
February 3rd, 2011, 10:46 AM
#3
Re: Upgrading from .NET 2 to .NET 4
I don't see a Target Framework option under Project Properties -> Application. Perhaps you have a different version of Visual Studio?
The real problem is why VS is not aware of any version > 2.0 of the .NET Framework? Why does the VS About dialog tell me I have Microsoft .NET Framework Version 2.0.50527 SP2?
Other applications are aware of .NET 4. I got notifications to download a new version of JAVA and an add on for FireFox. I see v2.0.50727 and v4.0.30319 when I search the registry.
I would have thought installing .NET 4 would have notified VS of the change. If not, then changing VSVARS32.BAT should have. Is there some other step I have missed?
I have all the service packs I should.
- VS 2005 Professional SP1
- 32 bit Vista SP2
-
February 3rd, 2011, 01:54 PM
#4
Re: Upgrading from .NET 2 to .NET 4
Install VS 2010. VS 2005 is too old.
www.monotorrent.com For all your .NET bittorrent needs
NOTE: My code snippets are just snippets. They demonstrate an idea which can be adapted by you to solve your problem. They are not 100% complete and fully functional solutions equipped with error handling.
-
February 3rd, 2011, 07:17 PM
#5
Re: Upgrading from .NET 2 to .NET 4
VS2005 only recognizes FW2.0 VS2008 recognizes FW2.0, 3.0, & 3.5. VS2010 can target 2.0, 3.0, 3.5, & 4.0.
-tg
-
February 3rd, 2011, 08:21 PM
#6
Re: Upgrading from .NET 2 to .NET 4
It may not be entirely true that VS 2005 is too old to work with .NET 4.
VS 2005 can work with .NET 3.5. See this link: Using .NET 3.5 and Visual Studio 2005. It has an article and many comments. See the comments for 3/20/2008 and 5/9/2008.
The link explains that there are 3 important parts:
- The .NET 3.5 framework is a set of libraries which are a superset of the .NET 2.0 libraries.
- A new 2008 C# compiler for use with the .NET 3.5 framework
- Editing and compilation support is provided by Visual Studio.
VS 2005 will compile against the .NET 3.5 assemblies.
However, new language syntax (E.G. Linq) is not supported by the old 2005 C# compiler.
Furthermore, VS 2005 does not support all the tools and editors of newer versions. In particular, as you guys say, it has no support for selecting the new compiler or a particular version of .NET.
Also for Visual C++, there is support from Microsoft for this. You can download the Windows SDK for Windows 7 and .NET Framework 4. The release notes for the SDK say
- Operating Systems: You can install this SDK on and/or create applications for Windows 7, Server 2008 R2, Server 2008, XPSP3, Vista, and Windows Server 2003 R2.
- Platform architecture: you can install this SDK on and/or create applications for platform chipsets X86, X64, and IA64 (Itanium).
- .NET Framework: you can use the SDK resources to create applications that target .NET Framework versions 2.0, 3.0, 3.5, 4.
- Visual Studio: you can use the resources in this SDK with Visual Studio versions 2005, 2008, and 2010, including Express editions. (Not all features work with all versions of Visual Studio. For example, you can’t use the .NET 4 tools with Visual Studio 2008.)
But perhaps you are right. I never will get all the new features in the old dev environment.
Maybe I should just get Visual Studio 2010. I will upgrade my stone ax while I am at it.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|