How to Set Local/Remote sources for NuGet in Visual Studio Mac

3.5k Views Asked by At

NuGet is not working on my Mac. It's trying to use a directory from a deleted project for every single project I make now. I'm not sure where the setting is at for NuGet on Visual Studio for Mac, but I am constantly (even after uninstalling then re-installing) getting these,

The local source '/Users/username/Projects/IMS/IMS/bin/Debug' doesn't exist.

or

Cannot resolve '/Users/username/Projects/IMS/IMS/bin/Debug' remote source.

in the NuGet/Package console output. I can't figure out how or why NuGet keeps defaulting to some IMS directory, and this is making installation of any non-local packages impossible. Any help or advice is appreciated

2

There are 2 best solutions below

1
lawiluk On BEST ANSWER

Firstly, it looks like an issue with .csproj. I would check if .csproj is having packages from this path. If yes, then I would delete them and add them again.

It's quite easy to check if it is a Nuget issue. Try adding some popular C# library from nuget to your project (doesn't matter which one). If it adds then it works fine. If you still want to check Nuget settings you have them in: Visual Studio ->Preferences -> Nuget -> Sources
Nuget location should be https://api.nuget.org/v3/index.json

0
Matt Ward On

The package source could be defined globally in the ~/.config/NuGet/NuGet.Config file. These package sources are available in Visual Studio for Mac in Preferences - NuGet - Sources.

Or the package source could be defined in a NuGet.Config file for the solution. If it is not in the global Preferences but is available if you open the Add Packages dialog then there is likely to be a NuGet.Config file somewhere either next to the solution or in a higher parent directory.

Package sources can also be defined via MSBuild in various NuGet specific MSBuild properties if you are using an SDK Style project or are using PackageReferences. That would result in the package source being added to the obj/project.assets.json file.