Reputation: 2438
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?
Upvotes: 6
Views: 7216
Reputation: 43046
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:
Upvotes: 2
Reputation: 20366
But once you installed .NET 4.5, all .NET 4 applications actually runs on the new version of .NET, the location of system DLLs is C:\Windows\Microsoft.NET\Framework\v4.0.30319
Do you mean VS2010 can only reference system DLLs in C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0
?
Won't see new types / new libraries at design time, but can use reflection to load at runtime?
Upvotes: 0
Reputation: 3385
Upvotes: 2
Reputation: 5918
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.
Upvotes: 10
Reputation: 30698
You will need VS2012 for .NET 4.5. VS2010 supports till .NET 4.0 only.
Upvotes: 1