我试图找出在这个示例项目中我可能做错了什么。当我的net462
应用参考文献anetstandard1.5
图书馆。该应用程序依赖于"System.Collections.Immutable": "1.3.0"
,根据 Nuget 的说法,它的目标是 NetStandard 1.0。该库取决于"NETStandard.Library": "1.6.0"
.
我是否设置了这些项目错误?我将非常感谢对此的任何见解......
这是他们的project.json:
app:
{
"buildOptions": {
"emitEntryPoint": true
},
"dependencies": {
"SomeLibrary": "1.0.0-*"
},
"frameworks": {
"net462": {
"dependencies": {
"System.Collections.Immutable": "1.3.0"
}
}
},
"version": "1.0.0-*"
}
Library
{
"buildOptions": {
"allowUnsafe": true
},
"dependencies": {
},
"frameworks": {
"netstandard1.5": {
"dependencies": {
"NETStandard.Library": "1.6.0"
}
}
},
"version": "1.0.0-*"
}
库所拥有的就是这个接口:
using System.Collections.Generic;
namespace SomeLibrary
{
public interface SomeInterface
{
int GetValue(KeyValuePair<string, int> somePair);
}
}
该应用程序实现此接口并调用具体类:
public class Program
{
public static void Main(string[] args)
{
var concreteObject = new ConcreteImplementation();
var answer = concreteObject.GetValue(new KeyValuePair<string, int>("key", 33));
Console.WriteLine(answer);
}
}
class ConcreteImplementation : SomeInterface
{
public int GetValue(KeyValuePair<string, int> somePair)
{
return somePair.Value;
}
}
如果我尝试运行该应用程序,则会出现以下错误:
{"Could not load file or assembly 'System.Runtime, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.":"System.Runtime, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"}
Stack: at ErrorExample.Consumer..ctor()
at ErrorExample.Program.Main(String[] args) in ..\ErrorExample\src\ErrorExample\Program.cs:line 11
我在这里缺少什么?
谢谢!