Edit

NuGet Error NU1105

Scenario 1

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 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.

Scenario 2

Invalid target framework 'net.6.0'

Issue

The project file exists but specifies an invalid target framework: 'net.6.0'. This can occur due to a typo or use of an unsupported format.

Solution

Update the project file to use a valid target framework. In this case, replace 'net.6.0' with 'net6.0' (without the extra dot). For a full list of supported frameworks and their correct formats, refer to the .NET Target Frameworks documentation.

Scenario 3

Unable to find project information for 'ProjectFile'. If you are using Visual Studio, this may be because the project is unloaded or not part of the current solution so run a restore from the command-line. Otherwise, the project file may be invalid or missing targets required for restore.

Issue

A project references another project (for example, via a <ProjectReference>) that isn't included in the current solution. NuGet can't find the restore information for the referenced project because it isn't loaded as part of the solution.

Solution

Command line

Run restore from the command line, targeting the solution file or the project file directly:

dotnet restore MySolution.sln

Running restore from the command line works even when not all projects are loaded, as it reads project files directly rather than relying on the solution load state.

Visual Studio

  • Add the missing project to the current solution, then reload the solution or run restore again.
  • If you intentionally exclude the project from the solution, run a command-line restore for the solution once before relying on Visual Studio's built-in restore. Visual Studio can then re-use the restore artifacts for the excluded project.