NuGet Error NU1105

Unable to read project information for 'ProjectFile'. The project file may be invalid or missing targets required for restore.

Issue

The project file exists but no restore information was provided for it. Ensure you are opening a project with the new project system or the legacy project system.

Solution

Command line

From the command line this could mean that the file is corrupt or that the NuGet.targets are not imported. To import the NuGet.targets, usually it's recommended to import the Microsoft.Common.targets. To restore projects in solution using .NET Core CLI use:

dotnet restore MySolution.sln

Visual Studio

In Visual Studio the error could mean that targets are not import similar to the command line scenario.

The error could also mean that the project is unloaded.

  • If you are using Visual Studio 2019 or later, NuGet has the ability to re-use artifacts from the previous restore for unloaded projects. In order for this scenario to work, you need to ensure that all projects currently in the solution have been restored from the command line prior to loading them in Visual Studio.

  • Alternatively, reload the project.