简体   繁体   中英

Jenkins cannot use MSBuild but Visual Studio can build

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?

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.

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?

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM