I have created some helper libraries (NuGet) and these work fine in my various .Net FullFramework and .Net Core applications.
However, when I add them to a particularly complicated Asp.Net MVC (.Net 4.7.2) web application, I get the following errors:
- The type 'System.Object' is defined in an assembly that is not referenced. You must add a reference to the assembly 'netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=....
- The type 'System.IComparable' is defined in an assembly that is not referenced. You must add a reference to the assembly 'netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=....
- The type 'System.IFormattable' is defined in an assembly that is not referenced. You must add a reference to the assembly 'netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=....
- The type 'System.IConvertable' is defined in an assembly that is not referenced. You must add a reference to the assembly 'netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=....
- The type 'System.ValueType' is defined in an assembly that is not referenced. You must add a reference to the assembly 'netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=....
In the "output" window, the last few are showing as:
ASPNETCOMPILER : error CS0455: Type parameter 'T' inherits conflicting constraints 'System.IFormattable' and 'System.IComparable'
My NuGet packages (A, B, C D and E) themselves have the following NuGet packages:
PackageA - <TargetFrameworks>netstandard2.0;netstandard2.1</TargetFrameworks>
- Microsoft.CodeAnalysis.FxCopAnalyzers 2.98
- NETStandard.Library 2.0.3
- StyleCop.Analyzers 1.1.118
PackageB - <TargetFrameworks>netstandard2.0;netstandard2.1</TargetFrameworks>
- PackageA
- Microsoft.CodeAnalysis.FxCopAnalyzers 2.98
- NETStandard.Library 2.0.3
- Newtonsoft.Json 12.0.3
- StyleCop.Analyzers 1.1.118
- System.Configuration.ConfigurationManager 4.7.0
- System.Data.SqlClient 4.8.1
PackageC - <TargetFrameworks>netstandard2.0;netstandard2.1</TargetFrameworks>
- PackageB
- Microsoft.CodeAnalysis.FxCopAnalyzers 2.98
- NETStandard.Library 2.0.3
- StyleCop.Analyzers 1.1.118
- System.Diagnostics.EventLog 4.7.0
PackageD - <TargetFrameworks>netstandard2.0;netstandard2.1</TargetFrameworks>
- PackageC
- Microsoft.CodeAnalysis.FxCopAnalyzers 2.98
- NETStandard.Library 2.0.3
- StyleCop.Analyzers 1.1.118
- System.Runtime.Caching 4.7.0
PackageE - <TargetFrameworks>netstandard2.0;netstandard2.1</TargetFrameworks>
- PackageD
- Microsoft.CodeAnalysis.FxCopAnalyzers 2.98
- NETStandard.Library 2.0.3
- StyleCop.Analyzers 1.1.118
I've tried the following, either all together, or one at a time...no luck.
- Added a NuGet reference to NETStandard.Library (2.0.3) and also tried 2.0.0 (because that was what was specifically asked for).
- Added
<Reference Include="netstandard" />
to my *.csprog file