Microsoft-authentication-library-for-dotnet: [Bug] Unable to update NuGet package with VS 2019 16.3.8

Created on 7 Nov 2019  路  9Comments  路  Source: AzureAD/microsoft-authentication-library-for-dotnet

Which Version of MSAL are you using ?
4.4.0

Platform
Xamarin android, Xamarin iOS

What authentication flow has the issue?

  • Desktop / Mobile

    • [ ] Interactive

    • [ ] Integrated Windows Auth

    • [ ] Username Password

    • [ ] Device code flow (browserless)

  • Web App

    • [ ] Authorization code

    • [ ] OBO

  • Web API

    • [ ] OBO

Other? - please describe;
Package installation / update

Is this a new or existing app?
The app is in production, and we toupgrade to a new version of MSAL

Repro
Try to update NuGet package with VS 2019 (16.3.8)

Expected behavior
Updated is installed successfully

Actual behavior
When trying to update Microsoft.Identity.Client from 4.4.0 to 4.5.1 or 4.6.0 we encounter the following error:

Failed to add reference. The package 'Microsoft.Identity.Client' tried to add a framework reference to 'System.Drawing.Common.dll' which was not found in the GAC. This is possibly a bug in the package. Please contact the package owners for assistance.
Reference unavailable.

Possible Solution
After some searching on the web we came across:
https://github.com/xamarin/xamarin-macios/issues/7249

Which deals with this error and proposes a workaround for the NuGet packeage maintainer:
Add true to the .csproj file.

answered external question Mobile-Android Mobile-iOS

Most helpful comment

I have seen this a bit before. Recommendation is to use the latest VS and PackageReferences I am not sure why that migration didn't work, but it is easy enough to do with an old pcl project: https://montemagno.com/how-to-convert-a-pcl-library-to-net-standard-and-keep-git-history/

For iOS itself you can do it manually by deleting that the packages.config and then adding the items manually in there instead of the dll if that right click isn't working.

All 9 comments

Thanks @Horizon0156 for the heads-up and the work around.
BTW, I cannot repro with VS 2019 16.3.7

Given your analysis, supposing this is an external issue, but we probably need to implement the work around. @henrik-me what do you think?

@jmprieur We can try to implement the work-around, but based on the issue referenced, it may or may not work.

Another work around, for developers, is to manually update the MSAL project by editing the csproj and packages, or move away from packages.config to PackageReference.

cc: @henrik-me @Horizon0156

Closing as answered

Hi all, I ran in to this today when trying to update from 4.4.0 to 4.7.1. I see it as marked as answered and have read the linked https://github.com/xamarin/xamarin-macios/issues/7249 but am not sure what I am supposed to do?

To quote from the linked thread "_The NuGet package maintainer needs to add the flag, not your app._" so my understanding is that this workaround is something that needs to happen on your end, I don't need to go editing .csproj files? If so, is this an issue with the latest package or is there something I need to do?

Thanks

@RhomGit , did you try the change @jennyf19 suggested?

move away from packages.config to PackageReference.

Thanks @henrik-me , I misunderstood.

For others, refer here: https://docs.microsoft.com/en-us/nuget/consume-packages/migrate-packages-config-to-package-reference

When I run the Migrate command on the Xamarin Forms project I get an error:
image
I know this is outside the scope of your MSAL project so I'm just posting fyi. I'll just stay at 4.4.0 for now, too hard.

@RhomGit you can also update the packages manually by editing the csproj file. it's just a hassle.

@mandel-macaque @jamesmontemagno
Do you have any suggestions on the above? looks like the migration from packages.config to packageReference did not work.

I have seen this a bit before. Recommendation is to use the latest VS and PackageReferences I am not sure why that migration didn't work, but it is easy enough to do with an old pcl project: https://montemagno.com/how-to-convert-a-pcl-library-to-net-standard-and-keep-git-history/

For iOS itself you can do it manually by deleting that the packages.config and then adding the items manually in there instead of the dll if that right click isn't working.

I just wanted to give some quick feedback that your recommendation worked as expected and I am now up to the latest build of MSAL.

Thanks @jennyf19 and @jamesmontemagno

Was this page helpful?
0 / 5 - 0 ratings