لدي مكتبة صف في netstandard1.5
، project.json
الخاص بي أدناه. عند تشغيل dotnet build
لي أخطاء مثل:
The type 'Exception' is defined in an assembly that is not referenced. You must add a reference to assembly 'mscorlib, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e, Retargetable=Yes'.
The type 'Object' is defined in an assembly that is not referenced. You must add a reference to assembly 'mscorlib, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e, Retargetable=Yes'.
The type 'Uri' is defined in an assembly that is not referenced. You must add a reference to assembly 'System, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e, Retargetable=Yes'.
The type 'Stream' is defined in an assembly that is not referenced. You must add a reference to assembly 'mscorlib, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e, Retargetable=Yes'.
في حزم RC1 يمكنني الإشارة إلى System.Runtime
وسيتم إصلاح ذلك. ولكن الآن RC2 وأنا أشير إلى NETStandard.Library
هذه الحزمة مضمنة.
أنا في حيرة من أمري تمامًا لماذا أتلقى هذه الأخطاء.
مشروع json
{
"version": "1.0.0-*",
"dependencies": {
},
"frameworks": {
"netstandard1.5": {
"imports": [ "dnxcore50", "portable-net45+win8+wp8+wpa81" ],
"dependencies": {
"Enums": { "target": "project" },
"VQViewModels": { "target": "project" },
"NovellLdap2": { "target": "project" },
"DDay": {"target": "project"},
"NETStandard.Library": "1.5.0-rc2-24027",
"System.Xml.XmlSerializer": "4.0.11-rc2-24027",
"System.Data.Common": "4.0.1-rc2-24027",
"System.Diagnostics.TraceSource": "4.0.0-rc2-24027",
"System.Net.Requests": "4.0.11-rc2-24027",
"System.Xml.XmlDocument": "4.0.1-rc2-24027",
"System.Xml.XPath.XmlDocument": "4.0.1-rc2-24027",
"System.Collections.Specialized": "4.0.1-rc2-24027",
"System.Data.SqlClient": "4.1.0-rc2-24027",
"System.Threading.Thread": "4.0.0-rc2-24027",
"System.Collections.NonGeneric": "4.0.1-rc2-24027",
"System.Diagnostics.TextWriterTraceListener": "4.0.0-rc2-24027",
"Microsoft.AspNetCore.Server.Kestrel": "1.0.0-rc2-final",
"Dapper": "1.50.0-rc2",
"FubarCoder.RestSharp.Portable.HttpClient": "3.2.0",
"MailKit": "1.3.0-beta7",
"Npgsql": "3.1.0"
}
}
}
}
حاولت عزله لكن لا يمكنني تكرار ذلك. مراجع المشروع هي ببساطة libs مع فئات مثل أدناه فيها ، بدون منطق أو تبعيات
public class Person
{
}
تقوم إحدى الحزم الخاصة بك بإحضار PCL قائم على mscorlib (على الأرجح بسبب استخدامك "imports":"portable-net45+win8+wp8+wpa81"
). لحل أنك تحتاج إلى الرجوع إلى "Microsoft.NETCore.Portable.Compatibility": "1.0.1-rc2-24027". تتيح هذه الحزمة التوافق مع PCLs القائمة على mscorlib.
شكرًا لتلك الحزمة ، بعد التحدث إلى davidfowl ، قمنا بتسليط الضوء على أنه FubarCoder.RestSharp.Portable.HttpClient
و imports
جلب BCL.
التعليق الأكثر فائدة
تقوم إحدى الحزم الخاصة بك بإحضار PCL قائم على mscorlib (على الأرجح بسبب استخدامك
"imports":"portable-net45+win8+wp8+wpa81"
). لحل أنك تحتاج إلى الرجوع إلى "Microsoft.NETCore.Portable.Compatibility": "1.0.1-rc2-24027". تتيح هذه الحزمة التوافق مع PCLs القائمة على mscorlib.