I created a .NET 4.6 ASP.NET 5.0 Preview Web API project.
I use the Random class. I get 2 compile errors.
System.Random as assembly does not exist. In my code editor I can see Random and the type seems imported but still I get compile erros.
How can I fix that?
答案 0 :(得分:2)
您正在使用核心框架,看起来它不包含Random类。请参阅“Missing package message”:您只需要包含NuGet包:System.Runtime.Extensions(注意:它是beta版,因此您必须使用Prerelease选项将此包包含在您的项目中)。
新的ASP.NET基础架构基于.NET Core,使其轻量级,并且易于在其他环境(如Mono或Windows Phone)中支持。因此,现在必须使用包添加完整框架中的许多可用内容。