2

From what I've understood, it should be possible to target net45 with the new xproj/project.json project settings in Visual Studio 2015. So, I created a new project, under web templates in the file->new project menu, edited the project.json and Class1.cs as listed below.

project.json:

{
  "version": "1.0.0-beta8",

  "frameworks": {
    "net45": {
      "dependencies": {
        "System.Runtime.Numerics": "4.0.0"
      }
    }
  }
}

Class1.cs:

using System.Numerics;

namespace NumericTest
{
    public class Class1
    {
        public Class1()
        {
            var biginteger = BigInteger.Parse("1234567890");
        }
    }
}

The error I'm getting is:

.NET Framework 4.5 error CS0234: The type or namespace name 'Numerics' does not exist in the namespace 'System' (are you missing an assembly reference?)

If I update the target framework to "dotnet", it compiles just fine. But how do I use the System.Numerics (and more specifically, BigInteger class) when targeting net45?

Cœur
  • 37,241
  • 25
  • 195
  • 267
Stenkross
  • 557
  • 4
  • 9

1 Answers1

1

Try to add an assembly reference to System.Numerics.dll in your project.

Rahul Tripathi
  • 168,305
  • 31
  • 280
  • 331
  • 1
    Doooh! Thanx! When I did that VS added a frameworkAssemblies entry to my project.json. Thank you very much! – Stenkross Oct 19 '15 at 08:59