Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

The type or namespace name" 'BigInteger' could not be found

Tags:

c#

Seriously bummed by this. Wanted to give BigInteger's a spin, but:

The type or namespace name" 'BigInteger' could not be found ...

I know how to add assembly references and such, but there is NO System.Numerics present at all - or then I'm completely and utterly blind.

How to fix?

Using Microsoft Visual Studio Community 2015.

In project properties:

Target framework: .NET Framework 4.5.2


System.Numerics is present (and selected) in Frameworks:

enter image description here

But still, even something this simple:

 using System;
 using System.Numerics;

 namespace CCHfT
 {
     class Program
     {
         static void Main(string[] args)
         {
             BigInteger b = 0;
             Console.WriteLine($"...{b}");
         }
     }
 }

...fails with the error message mentioned earlier.

like image 412
Scre Avatar asked Aug 31 '25 04:08

Scre


1 Answers

It appears that you're not looking in the right place. From your screenshot you can see that you're missing a ton of System. assemblies, and the ones that are shown all have older versions. This looks like what you would see under the COM -> Type Libraries section of the References Manager window.

Try selecting Assemblies -> Framework. You should see something like "Targeting: .NET Framework 4.5.2" at the top, and System.Numerics 4.0.0.0 in the list:

enter image description here

Also, ensure that after clicking 'OK' on the References window, that the reference appears under your Project Properties:

enter image description here

like image 71
Rufus L Avatar answered Sep 02 '25 17:09

Rufus L