Error NU1105 Unable to find project information - The project file may be invalid or missing targets required for restore

44,833

Solution 1

For me, the casing of the project file on disk did not match the casing in the solution file.

Say I had a solution with LibraryA.csproj and LibraryB.csproj, where LibraryB.csproj has a reference to LibraryA.csproj. Having an incorrect casing for LibraryA.csproj in the solution file would cause NU1105 when building LibraryB.csproj:

Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LibraryA", "LibraryA\Librarya.csproj", "{24DEBB3B-762A-491D-8B83-6D078C0B30C0}"

I started seeing this problem after upgrading to version 15.5 of Visual Studio 2017. I did not encounter this problem with version 15.4.5.

Solution 2

I also got the same after upgrading to version 15.6 of Visual Studio 2017.

Closing VS and deleting the .vs folder fixed it for me.

Solution 3

This error message will also occur if a referenced project is not included in the solution. I encountered this problem today, and I found the fix here.

Solution 4

I had this problem and I just followed what the error message recommends inside VS:
to restore the solution.

So I opened a command line or package manager console, chdir into the directory with the solution (.sln) file and just issued

C:> dotnet restore .\mySolution.sln

Problem was fixed.

Solution 5

I encountered this error when having a duplicate reference to a project.

<ProjectReference Include="..\ProjectA.csproj" />
<ProjectReference Include="..\ProjectA.csproj" />

Removing the duplicate reference resolved the error.

Share:
44,833
Paolo B
Author by

Paolo B

Updated on July 08, 2022

Comments

  • Paolo B
    Paolo B almost 2 years

    All of a sudden, I am getting the following errors for 3 projects in a solution:

    Error NU1105 Unable to find project information for 'C:\code\example\src\libs\example.I18n\example.I18n.csproj'. 
    The project file may be invalid or missing targets required for restore.
    

    The only thing that has changed in the project is a couple of DB changes, but I never had any issues in the past. The only other thing is that I updated to Visual Studio 2017 15.5. Could that cause issues?

    I have tried removing and recloning the solution from source control, but still getting errors. No problems on my colleagues' machines, so it must be something local.

    Example of one of the .csproj files if this helps:

    <Project Sdk="Microsoft.NET.Sdk">
    
      <PropertyGroup>
        <TargetFramework>net452</TargetFramework>
        <AssemblyName>Example.I18n</AssemblyName>
        <PackageId>Example.I18n</PackageId>
        <GenerateAssemblyConfigurationAttribute>false</GenerateAssemblyConfigurationAttribute>
        <GenerateAssemblyCompanyAttribute>false</GenerateAssemblyCompanyAttribute>
        <GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute>
      </PropertyGroup>
    
      <ItemGroup>
        <PackageReference Include="Microsoft.AspNetCore.Mvc.Core" Version="1.1.2" />
        <PackageReference Include="Microsoft.Extensions.Logging" Version="1.1.1" />
        <PackageReference Include="MessageFormat" Version="1.0.1" />
      </ItemGroup>
    
      <ItemGroup Condition=" '$(TargetFramework)' == 'net452' ">
        <Reference Include="System" />
        <Reference Include="Microsoft.CSharp" />
      </ItemGroup>
    
    </Project>