简体   繁体   中英

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

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?

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.

  1. Biginteger was introduced in .net 4.0
  2. For version earlier than .net 4.0, try intX

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.

You will need VS2012 for .NET 4.5. VS2010 supports till .NET 4.0 only.

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?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM