@robert-j-engdahl commented on Mon Sep 11 2017
Installing the NuGet package System.Collections.Immutable v1.4.0 targeting .Net 4.6.1 does not include its dependency towards netstandard.
After
install-package System.Collections.Immutable -ProjectName SomeProject
And using ImmutableHashSet
Analysis\Recalculation\Recursive\RecursiveAnalysisRecalculatorTest.cs(89, 104): error CS0012: The type 'Object' is defined in an assembly that is not referenced. You must add a reference to assembly 'netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'.
This goes for other types I've been using for ages such as IEnumerable<> and ValueType.
(And if this is not the right place to file such an issue, you might fix the link for the project site given here https://www.nuget.org/packages/System.Collections.Immutable/)
@robert-j-engdahl commented on Mon Sep 11 2017
This could be caused by my test projects being 4.6.1 and my production being 4.6.
It did, however, not help to
Install-Package NETStandard.Library -Version 2.0.0
There might be issues that concern the backwards compatibility of 4.6.1 that I am not aware of.
@wijays commented on Wed Sep 13 2017
Running into the same issue on 4.6.2.
@robertbaker commented on Fri Sep 29 2017
You will need to install the VS 2017 (MSBuild 2017) on your team city server. Additionally 4.6.0 won't work, you need at least 4.6.2.
https://www.visualstudio.com/thank-you-downloading-visual-studio/?sku=BuildTools&rel=15
Additionally, I would recommend changing your nuget's to package reference if you haven't already. Look for packages that were installed using an older .net framework version, you will need to reinstall those to ensure you get the correct versions.
Please close this issue as it's not related to .net/standard/core
@Petermarcu commented on Wed Oct 11 2017
There are some issues with 4.6.1's support of .NET Standard 2.0. For example netstandard.dll version 2.0.0 isn't there and needs to be present with the application (or test in this case). I'm going to move this issue to dotnet/standard because I do think there could be a problem here that we need to look into.
This is by-design. You need to ensure the NETStandard support package for .NET framework is installed to get those dlls. @dsplaisted @terrajobst can you please share a link?
I ran into this as well with .NET Framework 4.6.2 projects and downgrading to System.Collections.Immutable 1.3.1 worked around the problem.
@loop-evgeny how did you know to do that? I've been pulling my hair out with this and tried everything. Yours ended up being the correct solution for me.
@dmarlow Lucky guess. We upgraded from 1.3.1 to 1.4.0 recently and, while tearing my own hair out, it occurred to me to undo this seemingly-unrelated change just to see what happens.
@loop-evgeny @dmarlow but I have referenced the Microsoft.AspnetCore.Diagnostics 2.0.1 which depends on System.Reflection.Metadata 1.5.0 which depends again on System.Collections.Immutable >=1.4.0!
So I tried downgrading Diagnostics but got other problems!
Am I missing something?
Never downgrade packages. Missing netstandard.dll means you're missing the .NET 4.6.1 support build infrastructure for netstandard2.0. @dsplaisted / @terrajobst can you point folks to the docs that describe what's required in order to consume netstandard2.0 libraries in net4.6.1?
There are quite a handful of packages that all target NETStandard 2.0 that complain in .NET 4.6.2.
System.Collections.Immutable v1.4.0 (v1.3.1 works)
System.Reflection.Metadata v1.5.0 (v1.4.2 works)
Microsoft.Extensions.Configuration
Microsoft.Extensions.Configuration.Abstractions
Microsoft.Extensions.Primitives
System.Text.Encoding.CodePages
Microsoft.Extensions.Logging.Abstractions https://github.com/aspnet/Logging/issues/687
Maybe more but I'm tired of playing whack-a-mole. I thought I could upgrade NETStandard 1.6 to 2.0, but it seems that's not quite possible.
I'm unsure if the solution is to:
1) stay with netstandard 1.6
2) not use those, i.e. downgrade to previous/highest working version
3) upgrade to .NET 4.7.1 (since that has built-in support for netstandard 2.0?)
4) add some missing magic config sprinkles:
Guidance would be greatly appreciated.
I believe this issue is a duplicate of many others we've been seeing related to binding redirects - see https://github.com/dotnet/corefx/issues/32561#issuecomment-428138193 for a list of relevant issues where you should be able to find guidance on how to work around it.
Most helpful comment
There are quite a handful of packages that all target NETStandard 2.0 that complain in .NET 4.6.2.
System.Collections.Immutable v1.4.0 (v1.3.1 works)
System.Reflection.Metadata v1.5.0 (v1.4.2 works)
Microsoft.Extensions.Configuration
Microsoft.Extensions.Configuration.Abstractions
Microsoft.Extensions.Primitives
System.Text.Encoding.CodePages
Microsoft.Extensions.Logging.Abstractions https://github.com/aspnet/Logging/issues/687
Maybe more but I'm tired of playing whack-a-mole. I thought I could upgrade NETStandard 1.6 to 2.0, but it seems that's not quite possible.
I'm unsure if the solution is to:
1) stay with netstandard 1.6
2) not use those, i.e. downgrade to previous/highest working version
3) upgrade to .NET 4.7.1 (since that has built-in support for netstandard 2.0?)
4) add some missing magic config sprinkles:
Guidance would be greatly appreciated.