无法在ASP.NET 5类库中找到System.Math命名空间

时间:2015-02-04 18:16:48

标签: c# asp.net class-library asp.net-core

我正在尝试构建一个ASP.NET 5类库,它使用System.Math中的一些方法,即System.Math.Round(...)System.Math.Sqrt(...)

当我尝试构建它时。我收到以下错误:

Error   CS0103  The name 'Math' does not exist in the current context   ProjectName.ASP.NET Core 5.0    Class1.cs

我在project.json文件中包含了一些软件包来修复与System.LinqSystem.Collections.Generic相关的其他错误,但我无法使包含System.Math的软件包更好

我在哪里可以找到它?

这是我的project.json文件:

"version": "1.0.0-*",
"dependencies": {
},
"frameworks" : {
    "aspnet50" : { 
        "dependencies": {
        }
    },
    "aspnetcore50" : { 
        "dependencies": {
            "System.Runtime": "4.0.20-beta-22416",
            "System.Collections": "4.0.10-beta-22416",
            "System.Linq": "4.0.0-beta-22416",
            "System.Threading": "4.0.0-beta-22416"
        }
    }
}

1 个答案:

答案 0 :(得分:9)

添加对System.Runtime.Extensions

的引用

使用Package Search查找包含特定类型的包

相关问题