NU1301: The Local Source 'C:\Program Files (x86)\Microsoft Visual Studio\Shared\NuGetPackages' Does Not Exist

Post installation of Visual Studio 2019, UiPath Studio and on launching UiPath Studio, dependencies do not get resolved and error " NU1301: the local source 'C:\Program Files (x86)\Microsoft Visual Studio\Shared\NuGetPackages' does not exist" .

When Visual Studio is installed, it adds a default package source to the NuGet configuration, which points to the local machine's NuGet cache, located at C:\Program Files (x86)\Microsoft Visual Studio\Shared\NuGetPackages. This package source is used by default when Visual Studio is running and may also be used by other applications that use the NuGet client installed on the machine.

UiPath Studio also uses the NuGet client to manage its package dependencies. When UiPath Studio tries to resolve its package dependencies, it looks for the packages in the configured package sources, but since the package source configured in the NuGet configuration file does not exist on the machine, it throws the error: "Nu1301: the local source 'C:\Program Files (x86)\Microsoft Visual Studio\Shared\NuGetPackages' does not exist".

Resolution: In case under 'Manage Packages > Settings > Package Sources' there is no package source that points to the local machine's NuGet cache, modify the NuGet configuration file located at C:\Program Files (x86)\NuGet\Config\ where this default package source is defined by Visual Studio in order to remove it or modify it to point to a valid location on the machine.

The files that can be found here are:

  • The Microsoft.VisualStudio.FallbackLocation.config file is generated by the NuGet package manager when Visual Studio is installed. This file contains a list of fallback package sources that NuGet will use if it cannot find a package in the configured package sources. The package source C:\Program Files (x86)\Microsoft Visual Studio\Shared\NuGetPackages is defined here.
  • The Microsoft.VisualStudio.Offline.config file is also generated by the nuget package manager during Visual Studio installation. This file contains a list of package sources that NuGet will use when operating in offline mode, i.e., when the computer does not have internet access. By default, this file includes the local machine's NuGet cache and any package sources that have been configured in Visual Studio.

When this error message occurs when launching UiPath Studio, most likely it means it is still using the NuGet configuration from Visual Studio, which may explain why it was still looking for packages in the C:\Program Files (x86)\Microsoft Visual Studio\Shared\NuGetPackages folder, even though the directory does not exist on the machine. To ensure that UiPath Studio is using its own NuGet configuration, modify the NuGet configuration file C:\Program Files (x86)\NuGet\Config\Microsoft.VisualStudio.FallbackLocation.config to remove the default package source added by Visual Studio or modify it to point to a valid location on the machine.

Even though manually creating the directory 'C:\Program Files (x86)\Microsoft Visual Studio\Shared\NuGetPackages' would solve the issue, it is indeed best practices to let each application manage its own package dependencies and avoid manually modifying package cache locations or package sources, as this can lead to unexpected behavior and conflicts between applications.

1 Like