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
を参照しています。
なぜこれらのエラーが発生するのか、私は完全に困惑しています。
project.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"
}
}
}
}
分離しようとしましたが、複製できません。 プロジェクト参照は、以下のようなクラスを含む単純なライブラリであり、ロジックや依存関係はありません
public class Person
{
}
パッケージの1つは、mscorlibベースのPCLを導入しています( "imports":"portable-net45+win8+wp8+wpa81"
を使用している可能性があります)。 これを解決するには、「Microsoft.NETCore.Portable.Compatibility」:「1.0.1-rc2-24027」を参照する必要があります。 このパッケージにより、mscorlibベースのPCLとの互換性が可能になります。
そのパッケージがそれを行ったおかげで、 @ davidfowlと話した後、それがFubarCoder.RestSharp.Portable.HttpClient
であり、 imports
がBCLをもたらすことを強調しました。
最も参考になるコメント
パッケージの1つは、mscorlibベースのPCLを導入しています(
"imports":"portable-net45+win8+wp8+wpa81"
を使用している可能性があります)。 これを解決するには、「Microsoft.NETCore.Portable.Compatibility」:「1.0.1-rc2-24027」を参照する必要があります。 このパッケージにより、mscorlibベースのPCLとの互換性が可能になります。