'Error NU1105 Unable to find project information - The project file may be invalid or missing targets required for restore
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>
Solution 1:[1]
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 2:[2]
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 3:[3]
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 4:[4]
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.
Solution 5:[5]
What worked for me was to
- Remove the offending project
- Build the solution
- Re-add the project.
Solution 6:[6]
Seems that some projects were removed from solution file (don't know why). Fixed by undoing these solution file changes
Solution 7:[7]
I have next project structure (.Net Core projects):
../classLib
../../../webProject1
../../../webProject2
../../myWebProjects.sln
webProject1 and webProject2 reference classLib as project itself (not as .dll). When I opened my solution in VS 2019 and tried to build I got identical error NU1105: Unable to find project information for '../classLib.csproj'. error.
Before build depended projects you need to restore there dependency. What I did, just add
next Target to my webProject1.csproj and webProject2.csprojfiles.
<Target Name="PreBuild" BeforeTargets="PreBuildEvent">
<Exec Command="dotnet restore" />
</Target>
Solution 8:[8]
I recently came across Error NU1105 while using JetBrains Rider on Linux. So this involves Mono and the MSBuild version that comes with it.
It turns out this was being caused by my solution files being in a directory that was a symbolic link to another directory. I believe MSBuild was dereferencing the linked directory and instead referencing the source directory. This makes some of the referenced paths completely different, even though they are the exact same files, case, everything else. Opening the solution from the original location works perfectly now for me.
Solution 9:[9]
Reload the project which causes the problem, this will fix the issue,
As mentioned in the following link :
https://docs.microsoft.com/en-us/nuget/reference/errors-and-warnings/nu1105
Solution 10:[10]
I correct this error by simply running the clean solution option. Right click the solution in the solution explorer and choose clean solution.
Solution 11:[11]
This is insane, i tried all this: updated VS. manually deleted all bin folders, run dotnet restore, clean rebuild nothing works
solution: finally i unload all the projects and start reloading them into solution, one by one in the order they show dependency errors. then the last one just cascade fixes everything. No idea what was wrong
Solution 12:[12]
I was getting this error error NU1105: Unable to find project information for 'C:\folder2\project1.csproj'. but project1 that I had as part of the solution was located in C:\folder1\project1.csproj (it was also there in c:\folder2\project1.csproj too but not part of the solution, so it was confusing) Once I changed the reference to the correct location of the project it worked.
Solution 13:[13]
After spending 3 hours, trying out numerous solutions, what worked for me is that I had to undo my root solution sln file...some of the project references were removed..not sure how.
Solution 14:[14]
This happend to me when I had files with names exceeding OS's max path limit. Check your names ;)
Solution 15:[15]
In my case I did it and it worked for me
- goto Tools/CommandLine/Developer Command Prompt or Developer Powershell
- type this command and Enter "dotnet restore".
- Build your solution
That's all
Solution 16:[16]
Open powershell and running restore command solved my issue.
dotnet restore Sample.sln
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
