NuGet package restore failed Access to path is denied

This turned out to be a problem when NuGet packages are checked in to the source control system in folder packages.

The problem occurs when

  • Automatically restore missing NuGet packages is turned on in Visual Studio.
  • There are NuGet packages checked in to the source control system.
  • The TFS work space is a server work space.

When VS tries to restore NuGet packages, it will try to access the existing packages already in TFS, because the packages are read only as the workspace is a server workspace. VS will be denied access to the path to the package.

To solve this, either delete the existing packages, or turn off automatic package restore in Visual Studio.

The correct way is to have no packages checked in to the source control system, either keep the project up to date with NuGet, or create a local cache of packages.

No Configuration values in ASP.NET Core app when debugging in Visual Studio Code

This is a stupid mistake.

Make sure that in launch.json, the value for cwd is correct and is pointing to the same folder as the DLL of the .NET Core app.

By default current working directory is set to the workspace directory, the appsettings.json file is not there, thus when running the app, it doesn’t have any settings.