不确定我是否应该期望这个工作与否,但我正在尝试使用.net库(https://github.com/ewoutkramer/fhir-net-api)来自一个简单的控制台应用程序,在我的mac上使用coreclr RC1并且我正在点击跟随运行时异常:
System.IO.FileNotFoundException: Could not load file or assembly 'System.ComponentModel.DataAnnotations, Version=5.0.5.0, Culture=neutral, PublicKeyToken=ddd0da4d3e678217' or one of its dependencies. The system cannot find the file specified.
File name: 'System.ComponentModel.DataAnnotations, Version=5.0.5.0, Culture=neutral, PublicKeyToken=ddd0da4d3e678217' ---> System.IO.FileNotFoundException: Could not load the specified file.
File name: 'System.ComponentModel.DataAnnotations'
at System.Runtime.Loader.AssemblyLoadContext.LoadFromAssemblyName(AssemblyName assemblyName)
at System.Runtime.Loader.AssemblyLoadContext.Resolve(IntPtr gchManagedAssemblyLoadContext, AssemblyName assemblyName)
at System.Reflection.RuntimeAssembly.GetExportedTypes(RuntimeAssembly assembly, ObjectHandleOnStack retTypes)
at System.Reflection.RuntimeAssembly.GetExportedTypes()
at Hl7.Fhir.Introspection.ModelInspector.Import(Assembly assembly)
...
这是我的project.json的相关部分:
"dependencies": {
"Hl7.Fhir.DSTU21": "0.90.4"
},
"commands": {
"ConsoleApplication": "ConsoleApplication"
},
"frameworks": {
"dnx451": {},
"dnxcore50": {
"dependencies": {
"Microsoft.CSharp": "4.0.1-beta-23516",
"System.Collections": "4.0.11-beta-23516",
"System.Console": "4.0.0-beta-23516",
"System.Linq": "4.0.1-beta-23516",
"System.Threading": "4.0.11-beta-23516"
}
}
}
我尝试将"System.ComponentModel": "4.0.1-beta-23516"
添加到dnxcore50依赖项中,但似乎没有做任何事情。
奇怪的是,当我从coreclr运行时更改为单声道运行时(通过dnvm)时,一切正常。这是否可以与coreclr一起使用,或者我是否应该在其他地方寻找/不支持的内容?
我是.NET的新手,因此我可能会做一些愚蠢的事情......