skip to Main Content

I’ve installed a new package on an existing project.enter image description here

The problem is it’s detecting a different version of the Microsoft.Build.Framework. I got Version=17.5.0 for both Microsoft.Build and Microsoft.Build.Framework but it’s seeing Version=15.1.0.0.

I have the updated version of NuGet (Version 6.5.0) which is compatible with my Visual Studio (Version 17.5.5) which according to this answer should fix it.

I’ve also restarted Visual Studio and tried again, which should also fix it according to this answer.

Is there something more going on under the hood here?

2

Answers


  1. Chosen as BEST ANSWER

    Microsoft.Build.Locator solved my issue.

    To ensure that programmatic builds from your application match builds done within Visual Studio or MSBuild.exe, you might need to load the same version of the MSBuild assemblies that were installed with a specific version of Visual Studio and use the same SDKs that are available within that version of Visual Studio. Or, when you're creating a build application that will be run on machines that might have various installed versions of MSBuild, .NET, and Visual Studio, you might also want to find and use a consistent version of MSBuild. The Microsoft.Build.Locator API streamlines this process.


  2. Go to the /Obj folder and take a backup copy of your project.assets.json file.

    Edit the project.assets.json file removing the json chunks/segments that refer to the v15.1.0.0.

    Now try to install the v=17.5.0 reference and Visual Studio shouldn’t get confused and load an old version.

    If that fails you might want to delete your NuGet Cache using Visual Studio > Tools > Package Manager > Settings > click the Delete NuGet Packages button and then re-add the NuGet references via the Package Manager.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search