auth0 / auth0-oidc-client-net

OIDC Client for .NET Desktop and Mobile applications
https://auth0.github.io/auth0-oidc-client-net/
Apache License 2.0
86 stars 49 forks source link

Unable to build after installing Auth0.OidcClient.WinForms NuGet Package #205

Closed camohiddendj closed 3 years ago

camohiddendj commented 3 years ago

Describe the problem

NETSDK1135 SupportedOSPlatformVersion 10.0.18362.0 cannot be higher than TargetPlatformVersion 7.0. Auth0Test C:\Program Files\dotnet\sdk\5.0.301\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.TargetFrameworkInference.targets 185

What was the expected behavior?

Solution to build successfully.

Reproduction

Step 1.. Create new .NET 5.0 WinForms Project Step 2.. Add Auth0.OidcClient.WinForms via NuGet Step 3.. Attempt to build

Environment

WinFormsApp1-master.zip

frederikprijck commented 3 years ago

Hey,

This is a known thing with .NET 5 and less related to the SDK, see https://github.com/auth0/auth0-oidc-client-net/issues/167. I know it is a confusing error and not extremely well documented in the .NET documentation. Mainly it has to do with a mismatch between SupportedOSPlatformVersion and TargetPlatformVersion, when adding Microsoft.Windows.SDK.Contracts, which is a dependency of one of the dependencies in our SDK, see:

image

What you should do is update your csproj:

<TargetFramework>net5.0-windows10.0.18362.0</TargetFramework>

Be sure to also install Microsoft.Windows.CsWinRT, as mentioned in https://github.com/auth0/auth0-oidc-client-net/issues/167.

I downloaded your sample, did the above changes and the build succeeded.