4

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.

Daniel A. White
  • 187,200
  • 47
  • 362
  • 445
Scre
  • 454
  • 1
  • 10
  • 15
  • SN is part of 4.5.2. Not sure where you're looking for it. [edit] and describe how you are trying to add a reference to SN. –  Aug 18 '17 at 19:37
  • Well, it's in there, so double duh. –  Aug 18 '17 at 19:39
  • https://stackoverflow.com/questions/9824479/how-to-add-a-reference-do-system-numerics-dll –  Aug 18 '17 at 19:40
  • Right... and still, "using System.Numerics;" reds the crap out and I can't add a reference even as it's not in the list. – Scre Aug 18 '17 at 19:42
  • Possible duplicate of [The type or namespace name could not be found](https://stackoverflow.com/questions/4764978/the-type-or-namespace-name-could-not-be-found) – Am_I_Helpful Aug 18 '17 at 19:42
  • 2
    The list of assemblies in your screenshot is totally different than the list that I see when I add a reference. Somehow you're ending up in a different dialog - you're going to have to walk us through what you're doing step-by-step. – BJ Myers Aug 18 '17 at 19:43
  • No, but that's "Add Reference". Duh. –  Aug 18 '17 at 19:43
  • can you give a bigger screenshot, showing the entire add refrence window? Also, add the content of your .csproj file when you open it with a text editor in to your question. – Scott Chamberlain Aug 18 '17 at 20:04

2 Answers2

9

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

Rufus L
  • 36,127
  • 5
  • 30
  • 43
2

Figured it out ... facedesk ...

Was looking at WRONG piece of a multi-project solution. No wonder fiddling with references didn't work when I was fooling around with wrong sub-project's assembly reference list...

Need more coffee... -.-

Scre
  • 454
  • 1
  • 10
  • 15