Open mattleibow opened 5 years ago
Do you have environment variable MSBuildSDKsPath or MSBuildExtensionsPath set by any change? It seems like it is possible that your 2.2.300 SDK is loading 2.1.700 props/targets, as show above. This usually happens when folks set the PATH to the SDK manually using the environment variables above.
@mattleibow if you are using Mono MSBuild, then you probably have incompatible versions of Mono MSBuild and .NET Core SDK. The problem and possible solutions are described here: https://rider-support.jetbrains.com/hc/en-us/articles/360004180039
I have been looking at this error for over a week now and I think the whole .NET Core thing is broken. I am using mono 5.20 and msbuild 16.0. The only version of .NET Core that works is the 2.2.1xx series.
So I figured that if I install .NET Core 2.2.107 (and only that) and set the global.json to 2.2.107, then it would work, right? Well no, I get this error:
error MSB4018: The "GenerateDepsFile" task failed unexpectedly.
/usr/share/dotnet/sdk/2.2.107/Sdks/Microsoft.NET.Sdk/targets/Microsoft.NET.Sdk.targets(129,5):
error MSB4018: System.MissingMethodException: Method not found:
System.Collections.Generic.IList`1<NuGet.Packaging.Core.PackageDependency> NuGet.ProjectModel.LockFileTargetLibrary.get_Dependencies()
So I tried a few things, still no joy. But suddenly it started working. I thought I had done it. When reviewing my PR I found that I had forgotten to update my global.json to match my install version. I was using 2.2.108 in the global.json and the installed version of 2.2.107.
I get this message at the start of msbuild:
A compatible installed dotnet SDK for global.json version: [2.2.108] from [/home/matthew/Projects/SkiaSharp/global.json] was not found
Please install the [2.2.108] SDK or update [/home/matthew/Projects/SkiaSharp/global.json] with an installed dotnet SDK:
2.1.700 [/usr/share/dotnet/sdk]
2.2.107 [/usr/share/dotnet/sdk]
But, the build succeeds. In fact, I can stick ANY 2.2.1xx in the global.json, and as long as it DOES NOT match the .NET Core installed, it works. I even threw a curve ball with a 2.2.199 and that works.
If I delete the global.json, then the build fails again.
I tried all this as well with .NET Core 2.2.105 installed and 2.2.107 in the global.json and that works. Seems to be something wrong with the versions.
I would LOVE to use any of the 2.2.2xx+, but unfortunately that requires VS 2019, which is not possible at the moment because they dropped support for older Windows 10 SDKs. And, as this release that I am trying to build is a patch release, I don't really want to switch to an entirely different system and/or drop any support for anything.
Thanks @AndreyAkinshin for the info and link, I was able to resolve a few other errors to get me to this place.
I just noticed that I can't actually use a version number of 2.2.199 because then dotnet operations fail. Seems to work again if I use 2.2.108.1. I get a warning on macOS and Linux about the invalid version, but it still goes. Windows just works, no warnings.
I am not sure where you are getting version of the .NET Core SDK 2.2.199 and 2.2.108.1. These are not versions shipped by the .NET Core SDK team.
And @AndreyAkinshin is correct. The versions of these components are not all mix and match. They need to match. In your case, 2.2.100 is equivalent of VS 15.9. Not sure what version of Mono would be equivalent to that though.
@livarcocc I am just making up numbers 2.2.199 and 2.2.108.1 just to be able to build. If I use real version numbers, then it doesn't.
@mattleibow I don't follow why are you coming up with random version numbers at all. That should really not be the solution to whatever problem you are running into.
From the original description of the issue, this happens because you are using a .NET Core SDK version with versions or Mono and MSbuild that it is not really compatible with.
That is the thing. I have set up all the versions to be correct on devops and so it should work. But it doesn't. Unless I make up a random version in the global.json.
Can you share the output of dotnet --info in the devops machine?
I suspect the bogus global.json might be forcing a particular SDK to be picked that happens to work.
Do you have any updates?
I have the same issue on a 24-core CPU on CI. Environment: Gitlab Runner 13.10.0 on Ubuntu 18.04 LTS. Using docker image sha256:82e2a34647f0a8a8bf83c2cc2e80fd4a4149a702b696ac18c838c725662303ad for mcr.microsoft.com/dotnet/sdk:3.1 with digest mcr.microsoft.com/dotnet/sdk@sha256:72cdb39fe665873fef8dba77a9000ff6d1d57dde8f2fe64d04ed799b6e0e62ae.
I am trying to use Ubuntu 18.04 to test some things, and I can use any of the newer .NET Core SDKs.
I just installed a fresh VM with 18.04, and installed my usual tools. I then try and build SkiaSharp, and then the .NET Standard projects and Tizen fail to build with the same error.
I can roll back to dotnet-sdk-2.1.105, and that seems to work fine. As soon as I go later, then it fails. I tried installing a different version of dotnet 2.2, but I only have one for some reason. Sure, I could install it manually and all that. But, who wants to do that - and I am not even sure it is going to work.
Here is my apt-search output: https://gist.github.com/mattleibow/935de7d22b24cfcf3ae9ab0c16b1908f
What is the reason for these failures? My code was working - as it is building just fine with 2.1.105, and then I bump up just a fraction and boom?
Build Errors: