0

Getting following error: Could not load file or assembly 'Azure.ResourceManager.ResourceGraph, Version=1.0.0.0, Culture=neutral, PublicKeyToken=92742159e12e44c8'. The system cannot find the file specified.

Have tried cleaning, removing and reinstalling the package, completely removing the .nuget folder, starting a new project and repulling the repo, eliminating all related code and references, various entries suggested on the InterWebz into the project file, but same error, over and over.

Something slightly suspicious: the package version on NuGet is 1.0.0 but the error references Version=1.0.0.0 (extra zero).

Note that the package works fine in a different solution.

cjr
  • 25
  • 6

1 Answers1

0

Solved but in a flummoxing manner. The solution is a project that makes a DLL and a demo project that uses that DLL to illustrate how to use the DLL in practice. The Demo project does not call ResourceGraph at all, only the DLL does. But when I added the ResourceGraph to the Demo project, the error went away. That's not how it's supposed to work, right? Or am I misunderstanding how dependencies work. If a Project calls a DLL that has dependencies, does that Project also need to add the packages that the DLL uses? I have not referenced the ResourceGraph package with "using" in the Demo program, but adding the package still fixed it. Thoughts?

cjr
  • 25
  • 6
  • You should be able to use [bindingRedirect](https://learn.microsoft.com/en-us/dotnet/framework/configure-apps/file-schema/runtime/bindingredirect-element) to use the specified version. – Jiale Xue - MSFT Feb 07 '23 at 07:43
  • If this method solves your problem, you can mark it as an answer. This can help someone with the same problem. – Jiale Xue - MSFT Feb 16 '23 at 08:47
  • Thank you for your input. It was not a version or bind redirect issue. It was fixed by adding the package to the solution, but this feels more like a hack than a fix, so this issue's true solution remains elusive. – cjr Feb 19 '23 at 18:37