Mscorlib未在Asp.Net 5类库中引用

时间:2015-02-13 17:08:47

标签: c# asp.net-core visual-studio-2015 .net-core

我正在尝试将库移植到ASP.NET CORE,但我很难让Visual Studio引用所有重要部分。我注意到mscorlib仅添加到ASP.NET 5.0下的引用中,但不添加到ASP.NET CORE下。在这两个框架下,即使在ASP.NET 5.0下引用了mscorelib,我也没有得到像System.Object这样的基类型

起初我使用的是beta2但后来我构建了自己的CoreCLR并使用kvm将其安装在我的机器上。

Kvm列表显示以下内容:

Active Version           Runtime Architecture Location                      Alias
------ -------           ------- ------------ --------                      -----
       1.0.0-beta4-11037 clr     x64          C:\Users\SomeName\.k\runtimes
       1.0.0-beta4-11037 clr     x86          C:\Users\SomeName\.k\runtimes
  *    1.0.0-beta4-11037 coreclr x64          C:\Users\SomeName\.k\runtimes default
       1.0.0-beta4-11037 coreclr x86          C:\Users\SomeName\.k\runtimes

当我尝试在visual studio中调试我的项目时,它只能在beta2下运行,但不能在我的自定义构建下运行。所以我必须手动运行我的项目:

k run -r CoreCLR -X64

一切都运行得很好。

我可以通过调试调试器来调试Visual Studio中正在运行的项目,但这不是一个好的体验。当然这是beta状态,但我的设置可能有问题,有人可以帮助我。

project.json

{
"version": "1.0.0-*",
"dependencies": {
     "Microsoft.Framework.ConfigurationModel": "1.0.0-beta4-1083",
    "Microsoft.Framework.ConfigurationModel.Json": "1.0.0-beta4-10837",
    "Microsoft.Framework.ConfigurationModel.Xml": "1.0.0-beta4-10837",
    "System.Collections": "4.0.10-beta-22613",
    "System.Collections.Concurrent": "4.0.10-beta-22613",
    "System.Collections.NonGeneric": "4.0.0-beta-22613",
    "System.Collections.Specialized": "4.0.0-beta-22613",
    "System.ComponentModel": "4.0.0-beta-22613",
    "System.ComponentModel.Annotations": "4.0.10-beta-22613",
    "System.ComponentModel.EventBasedAsync": "4.0.10-beta-22613",
    "System.ComponentModel.TypeConverter": "4.0.0-beta-22613",
    "System.Diagnostics.Tools": "4.0.0-beta-22613",
    "System.Diagnostics.TraceSource": "4.0.0-beta-22613",
    "System.Dynamic.Runtime": "4.0.10-beta-22613",
    "System.Linq": "4.0.0-beta-22613",
    "System.Linq.Expressions": "4.0.0-beta-22613",
    "System.ObjectModel": "4.0.10-beta-22613",
    "System.Reflection": "4.0.10-beta-22613",
    "System.Reflection.Emit.ILGeneration": "4.0.0-beta-22613",
    "System.Reflection.Extensions": "4.0.0-beta-22613",
    "System.Reflection.Primitives": "4.0.0-beta-22613",
    "System.Reflection.TypeExtensions": "4.0.0-beta-22613",
    "System.Runtime": "4.0.20-beta-22613",
    "System.Runtime.Extensions": "4.0.10-beta-22613",
    "System.Runtime.Serialization.Json": "4.0.0-beta-22613",
    "System.Runtime.Serialization.Primitives": "4.0.0-beta-22613",
    "System.Runtime.Serialization.Xml": "4.0.10-beta-22613",
    "System.Security.AccessControl": "4.0.0-beta-22613",
    "System.Security.Claims": "4.0.0-beta-22613",
    "System.Security.Principal": "4.0.0-beta-22613",
    "System.Security.Principal.Windows": "4.0.0-beta-22613",
    "System.Text.RegularExpressions": "4.0.10-beta-22613",
    "System.Threading": "4.0.10-beta-22613",
    "System.Threading.AccessControl": "4.0.0-beta-22613",
    "System.Threading.Tasks": "4.0.10-beta-22613",
    "System.Threading.Thread": "4.0.0-beta-22613",
    "System.Threading.ThreadPool": "4.0.10-beta-22613"
},
"frameworks": {
     "aspnet50": {
        "dependencies": {
        }
    },
    "aspnetcore50": {
        "dependencies": {
        }
    }
}

更新 我注意到Visual Studio没有加载正确的包,即使它显示刷新,所以我更新了所有内容:

kpm restore

这改善了一切。但是我仍然无法在Visual Studio中正确运行它,因为我在加载System.Threading时遇到类型加载异常。 手动运行仍然没有问题。

看起来我必须等到Visual Studio的下一个版本出来才能获得更好的体验。

我很想知道在哪里获取System.Runtime的源代码来检查ASPNETCORE50中实现的内容。

1 个答案:

答案 0 :(得分:0)

在Beta2和Beta4之间,文件夹结构发生了变化。 VS的公共版本不了解最新的运行时。对不起,在更新的VS工具到来之前,您无能为力。如果您使用VS,请暂时继续使用Beta2。

相关问题