0

How do I resolve conflicting dependencies between my visual studio extension and the built in nuget package manager? I am getting an error that Nuget.PackageManagement.VisualStudio, Version=5.0.0.0 is attempting to resolve Microsoft.VisualStudio.ProjectSystem, Version=16.0.0.0 but can't find it. I am not referencing either of those packages for the versions listed. I am referencing Nuget.PackageManagement.VisualStudio, Version=4.8.0.6and I am not referencing Microsoft.VisualStudio.ProjectSystem. I went to add those packages but version 5.0 of Nuget.PackageManagement.VisualStudio and 16.0 of Microsoft.VisualStudio.ProjectSystem do not exist on nuget.org even looking at pre-release packages.

I know I could just grab the dlls I need from C:\Documents and Settings\<my user>\AppData\Local\Microsoft\VisualStudio\15.0_c9b36733Exp\Extensions\Microsoft Corporation\NuGet Package Manager for Visual Studio 2017\15.99.99 but I am sure this is not the intended way to resolve this issue. I am also aware that I could modify the visual studio binding redirects but I would prefer not to do that. Is there any means for me to resolve this issue without resorting to grabbing the dlls from the visual studio package managers extension or modifying the devenv.exe binding redirects?

Max Young
  • 1,522
  • 1
  • 16
  • 42
  • 1
    You're not the only one... See my 1st comment here: https://stackoverflow.com/questions/50808935/dependency-problems-after-update-nuget-packages-of-a-visx-project – Simon Mourier Nov 06 '18 at 18:44
  • @SimonMourier Thank you for linking your question, that is very similar to the issue I am running into. – Max Young Nov 06 '18 at 19:08
  • @SimonMourier I switched to PackageReference in my vsix but no change. My dlls are being include using both PackageReference and package.config it is just that I am not using the same version of dependencies as Visual Studio is. – Max Young Nov 06 '18 at 21:55
  • You must 1) carefully note everything down somewhere to make sure you don't forget something, 2) remove all references manually, 3) delete package.config completely (nothing will compile anymore), then 4) switch to packagereference and 5) recreate needed references (wich will be package references). You should have far less *visible* package reference than before. – Simon Mourier Nov 06 '18 at 22:54
  • @SimonMourier Yeah, I followed the steps in your comment on the other issue. I copied my package.config and add back the top level dependencies so that I didn't have a ton of dependencies. I no longer have a package.config and now have PackageReferences in my csproj. In my previous comment I meant that the packages are being included in the vsix no matter what method I use but I am still getting the issue. – Max Young Nov 06 '18 at 23:27
  • Maybe you should check inside the .csproj directly if there's anything left suspicious from the previous configuration. Some nugets do modify it, and we have sometimes to remove what they did manually. – Simon Mourier Nov 07 '18 at 06:26
  • 1
    Visual Studio version 16 is (going to be) Visual Studio 2019, whereas Visual Studio 2017 is version 15. So, I wouldn't expect an extension that needs a VS16 dll to work in VS15. When I download the latest `NuGet.PackageManagement.VisualStudio` nupkg, extract it, open the dll in ildasm and look at the manifest, it requires version 15 of `Microsoft.VisualStudio.ProjectSystem`, not version 16. So, there's probably an assemblies redirect issue going on. You'll need to look though the transitive graph of dependencies to see what's pulling in version 16 of the package/dll. or give us enough to repro – zivkan Nov 07 '18 at 15:58
  • @Ziv So for some reason there is an extension using `Nuget.Packagement.VisualStudio` 5.0 in my experimental VS. This instance of VS was just made yesterday so I am unsure how it got there. I have found that my package works fine with the none experimental VS because I dont have an extension that is loading the 16.0 project system. If you would like to submit that as the answer I will accept it because you got to it literally minutes before I did. – Max Young Nov 07 '18 at 16:00

1 Answers1

1

The NuGet team's current versioning scheme is 11 major versions behind VisualStudio's. So, NuGet v5.0.0 is targeting Visual Studio v16.0.0, which will be Visual Studio 2019, which isn't out yet. A Visual Studio 2017 extension needs to target VS15.x, so needs NuGet v4.x dlls.

So, you need to look though your dependencies and figure out what is pulling in NuGet.PackageManagement.VisualStudio 5.0.0 and make sure it gets a version 4.x.x instead.

zivkan
  • 12,793
  • 2
  • 34
  • 51