microsoftgraph / msgraph-sdk-dotnet-auth

Archived - use the TokenCredential classes provided by Azure.Identity. https://docs.microsoft.com/en-us/dotnet/api/overview/azure/identity-readme
https://graph.microsoft.com
MIT License
78 stars 19 forks source link

microsoft.identity.client 4.8.0 unlisted from nuget #60

Closed shawnjones253 closed 4 years ago

shawnjones253 commented 4 years ago

Microsoft.graph.auth requires microsoft.identity.client 4.8.0, which appears to have been delisted from nuget

This causes different behavior depending on the type of csproj file:

With a new-style csproj (microsoft.net.sdk), the 4.8.0 dll somehow ends up correctly showing up in the output directory

With an old-style csproj (the kind you have with an asp.net project, for example), and with a packages.config, adding this project will result in microsoft.identity.client 4.8.1-preview1 being downloaded from nuget and put in the packages folder, and you will also get an assembly binding redirect to 4.8.1 in the app.config/web.config

The problem comes when you need to reference one from the other (ex: the new-style csproj produces the .exe but depends on an old-style csproj library). In this case the library's code now expects version 4.8.1, but the exe's output folder will have the 4.8.0 version, and you get a runtime error like:

System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.IO.FileLoadException: Could not load file or assembly 'Microsoft.Identity.Client, Version=4.8.1.0, Culture=neutral, PublicKeyToken=0a613f4dd989e8ae' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

MIchaelMainer commented 4 years ago

Can you try clearing your NuGet cache and restoring the packages at that point? Please let us know the outcome.