Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Do I need visual studio 2012 for .NET 4.5 or is visual studio 2010 fine for 4.5?

Tags:

c#

.net

I have installed the .NET Framework 4.5 but I can only use .NET Framework 4.0 in my project, which doesn't support BigInteger. Do I need Visual Studio 2012 for 4.5 or is Visual Studio 2010 fine for 4.5?

like image 582
Jordan Trainor Avatar asked Nov 29 '12 03:11

Jordan Trainor


People also ask

What is the .NET framework for Visual Studio 2012?

The . NET Framework 4.5 includes enhancements for ASP.NET 4.5. Visual Studio 2012 also includes enhancements and new features for improved web development. This document provides an overview of many of the new features that are included in Visual Studio 2012.

What is the .NET framework for Visual Studio 2010?

The functionality of Visual Studio 2010, . NET Framework 4 and Silverlight 4 creates a powerful and unique combination, opening up new opportunities for developers to build applications that take advantage of new and existing devices, as well as emerging platforms like cloud services.”

Is Visual Studio and .NET same?

The two products are different but intimately related. Visual Studio . NET is an application-development tool for writing applications; the . NET Framework provides the infrastructure required to run those applications.

Is .NET framework installed with Visual Studio?

You can install on: Starting with Visual Studio 2022, Visual Studio no longer includes . NET Framework components for . NET Framework 4.0 - 4.5. 1 because these versions are no longer supported.


2 Answers

Yes, you need VS 2012 to use .NET 4.5, however, BigInteger was introduced in .NET 4

Every modern version of Visual Studio (VS 2002 on) is keyed to a specific .NET Framework version, and cannot "see"/use newer versions released after that VS version. More recent VS versions, VS 2008 and beyond can "see" some older framework versions, but CANNOT "see" newer versions of .NET.

VS 2008 keyed to .NET 3.5 and can use 2.0 and 3.0. CANNOT use 4.0 or 4.5

VS 2010 keyed to .NET 4.0 and can use 3.5, 3.0 and 2.0. CANNOT use 4.5

VS 2012 keyed to .NET 4.5 and can use 4.0, 3.5, 3.0 and 2.0

If you need features introduced in .NET Framework 4.5, you need VS 2012.

like image 117
CC Inc Avatar answered Sep 22 '22 05:09

CC Inc


As others have noted, BigInteger was introduced in .NET 4.0, not .NET 4.5. Through our exchange in the comments, it appears that you had not referenced System.Numerics.dll in your project.

VS project references tell the C# compiler which assemblies define the types that will be used in the C# code being compiled. The default Visual Studio project templates do not include references to the entire .NET framework. Several more specialized assemblies, such as System.Numerics, are omitted; if you want to use them, you have to add the reference yourself.

People frequently confuse the using directive (using System.Numerics;) with the reference itself. The using directive only helps the compiler with resolving type names; it concerns a namespace. For the compiler to find the types themselves, you need a reference, which identifies an assembly.

That information should help clarify the error message "The type or namespace name 'Numerics' does not exist in the namespace 'System' (are you missing an assembly reference?)". This means that the compiler has examined all the referenced assemblies, and it has found no type or namespace called System.Numerics.

To add an assembly reference in VS 2010:

  1. Open the solution explorer
  2. Expand the node for the project in question
  3. Right-click the References node
  4. Choose "Add Reference...". A dialogue box opens.
  5. Open the ".NET" tab
  6. Locate "System.Numerics" in the Component Name list
  7. Click the "OK" button.
like image 45
phoog Avatar answered Sep 20 '22 05:09

phoog