Package source mapping does not work since 17.5.0

8.9k views Asked by At

I have recently had the problem that all my projects have difficulties with the Nuget packages. Since they seem to be equipped with additional security since version 17.5, I have to reconfigure them. Unfortunately, this does not work. As an example with the Nuget package: Microsoft.EntityFrameworkCore

Does anyone have an idea how I can solve this?

https://learn.microsoft.com/de-de/nuget/consume-packages/package-source-mapping As with Microsoft's documentation on this page, I am supposed to follow the steps. I have done that. Unfortunately, it doesn't work at all. VS does not respond to the package source mapping at all. I have VS 2022 Preview Version 17.7.0.

I've been trying to install the nuget packages manually for days, and that doesn't work either. VS does not find them.

2

There are 2 answers

0
Ivan Efimov On

Try to keep %appdata%\NuGet\NuGet.Config clear from anything but your package sources:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <packageSources>
    <add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
    <add key="Microsoft Visual Studio Offline Packages" value="C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\" />
  </packageSources>
</configuration>
0
Geo On

Make sure the NuGet.Config file or your package sources in VS do not have any sources which you no longer want or need. In my case it was an old version of DevExpress local packages that just needed an update - but Visual Studio decided it couldn't download any packages from any source until I removed the unwanted source.