1
votes

I have a UWP project, in visual studio 2017, it can build without a problem. But when I write script to build in Jenkins, I use below command:

nuget restore MySolution.sln

MSBuild.exe MySolution.sln /t:Clean;Build /p:Configuration=Release /p:Platform=x64 rem /verbosity:diagnostic

But I see the error: Autofac.Extras.CommonServiceLocator 5.0.0 is not compatible with UAP,Version=v10.0.16299. Some packages are not compatible with UAP,Version=v10.0.16299.

How in visual studio 2017 it doesn't think the packages are incompatible, but in MSBuild, it takes them as incompatible?

1
Is it MSBuild throwing the error or is nuget restore where the error is? Have you ensured your nuget.exe is the latest?Travis Illig
I check the log, it is nuget restore throws this error. I download nuget.exe 4.6 the latest version, seems not helpful. I wonder whether I should do "nuget restore XXX" at project levelspspli
I also try MSBuild.exe MySolution.sln /t:restore /t:Clean;Build /p...., also not work, my MSBuild.exe version is v15, nuget.exe version is 4.6, and all the package references are described in project files, not in packages.configspspli
You may need to turn logging up and paste into the question the full output of what NuGet is saying. There is some sort of tooling problem or mismatch (obviously, since it works in VS) but there's unfortunately not enough info here to troubleshoot it.Travis Illig
Hi Travis! You are the author of Autofac.Extras.CommonServiceLocator?! So excited you are here and answer my question!! I just leave in issue board in github about the issue. There are not much more info in the log, when I use nuget restore MySolution.sln, it just saying the target framework of this Autofac.Extras.CommonServiceLocator 5.0.0 is net45 and standard2.0, but when I restore and build in visual studio, nothing complains at all. I have to use that nuget restore in script for my daily build.spspli

1 Answers

1
votes

Autofac.Extras.CommonServiceLocator supports netstandard 2.0. According to the docs on netstandard netstandard 2.0 and Universal Windows 10.0.16299 are compatible. This is why it works fine in VS.

If NuGet restore is not seeing these things as compatible, that's usually a problem with the NuGet command line version being used. Sometimes it also has to do with a NuGet.config file incorrectly being in the same folder as NuGet.exe and directing NuGet to use a different set of feeds than VS is using.

All of this adds up to a tooling problem, which, without a repro and logs, is very hard to troubleshoot. As I mentioned in my comments, more info is needed.

If Autofac.Extras.CommonServiceLocator switched to use CommonServiceLocator 2.0.3 it might enable targeting a lower netstandard, but that likely won't solve your problem - it's already compatible, as you've seen in VS.

I would recommend:

  • Make sure you have the latest NuGet.exe
  • Make sure you don't have NuGet.config in the same folder as NuGet.exe.
  • Remove all build artifacts and user files (like the .vs folder, bin and obj folders).
  • Clean out your temp files.
  • Clear your NuGet cache - nuget locals clear -all

Then try again.

I'm sorry there's not much more I can offer. Like you said, it works in one spot, not in another. That's a tooling and environment problem, which, without a repro or specific set of repro steps that work on other machines, is really hard to solve.