[Preview] Unable to restore packages from feeds with encrypted passwords on windows
See original GitHub issueDescribe the bug
After the recent update of VS Preview (I got the telemetry prompt earlier today), I’m not able to restore packages from feeds that use an encrypted password.
To Reproduce
- Make sure some password-protected feeds are registered and they use encrypted password
- Prepare a project that requests something from the feed
- Run
dotnet nuget locals all --clear
just in case to make sure the restore operation is needed - Run
dotnet restore
Exceptions (if any)
Retrying 'FindPackagesByIdAsyncCore' for source 'https://nuget.xyz.com/repository/nuget-prod/FindPackagesById()?id='Package'&semVerLevel=2.0.0'.
Password decryption is not supported on .NET Core for this platform. The following feed uses an encrypted password: 'repo-name'. You can use a clear text password as a workaround.
Windows Data Protection API (DPAPI) is not supported on this platform.
Detailed exception.
Further technical details
- Windows 10 21H2
- SDK
6.0.200-preview.21617.4
Workaround
Use global.json
and downgrade to 6.0.100
.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:42
- Comments:64 (10 by maintainers)
Top Results From Across the Web
Password decryption not supported on .NET Core for ...
Enables storing portable package source credentials by disabling password encryption. This command will update your nuget.
Read more >nuget.config File Reference
Passwords are encrypted and cannot be added manually. For no_proxy , the value is a comma-separated list of domains the bypass the proxy...
Read more >Fixing NuGet error: Unable to load the service index for source
Something I've ran into several times is when running dotnet restore or dotnet add package <name> , the tool throws and error with...
Read more >NuGet packages in the Package Registry
Open Visual Studio. · In Windows, select Tools > Options. On macOS, select Visual Studio > Preferences. · In the NuGet section, select...
Read more >NuGet keeps prompting for credentials when connecting to ...
Hello,. I am having an issue where Visual Studio keeps asking me to enter my username and password to my nuget source which...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I debugged this issue with
dotnet restore -v diag
command. Here is the most inner exception in the stack trace:So the problem seems to be the
System.Security.Cryptography.ProtectedData.dll
. The dotnet installation contains the non platform specific version of the DLL at the root level (C:\Program Files\dotnet\sdk\6.0.200\System.Security.Cryptography.ProtectedData.dll
). The implementation of this DLL just throws theSystem.PlatformNotSupportedException
since theProtectedData
is only supported on Windows platform.The Windows platform specific DLL is found under the runtimes directory (
C:\Program Files\dotnet\sdk\6.0.200\runtimes\win\lib\netstandard2.0\System.Security.Cryptography.ProtectedData.dll
).For some reason the dotnet executable is using the non platform specific version of the DLL and not the Windows platform specific version.
I was able to workaround the issue by removing the non platform specific DLL at
C:\Program Files\dotnet\sdk\6.0.200\System.Security.Cryptography.ProtectedData.dll
. After this, the dotnet started using the correct one fromC:\Program Files\dotnet\sdk\6.0.200\runtimes\win\lib\netstandard2.0\System.Security.Cryptography.ProtectedData.dll
and restore started working again.EDIT: Environment where I tested is Windows Server 2016.
The MSBuild-side revert is merged to daily builds of the 6.0.2xx SDK, and the next patch release of the .NET SDK should have the fix.