Bruno Zell
Bruno Zell

Reputation: 8551

Recursive csproj Dependencies With Git Submodules And .Net-Core

First of all, I'm aware of this question and it's pretty similar, but it's outdated since I use the new .Net-Core 2.0 csporj format

Setup

I have recursive submodules. If I pull in a csproj via a submodule, this csproj does have a ProjectReference to another csproj in a nested submodule.

Error

When I only add the top level dependencies to the solution (.sln), NuGet package restore fails with NU1105: The project file exists but no restore information was provided for it. This is caused by the ProjectReference with a path to a csproj which is not added to the current solution.

Restore and build succeeds when I add all csproj files to the solution.

Question

Usually when I pull in a submodule, I only care about the root csproj and not all of it's dependencies. So I don't want to add all nested csproj files to the solution. Is there still a way to get NuGet working and build all csproj files that are referenced (and are not added to the solution) with msbuild?

Upvotes: 0

Views: 2371

Answers (1)

Leo Liu
Leo Liu

Reputation: 76870

Recursive csproj Dependencies With Git Submodules And .Net-Core

This is a known issue about restore doesn't work for project references not included in a solution:

https://github.com/dotnet/project-system/issues/2759

and

https://github.com/NuGet/Home/issues/5350

For tracking this issue, I recommend that you vote on and follow the earlier reported issue for updates and fix notifications.

The current workaround is add the add all csproj files to the solution(What you have done).

Hope this helps.

Upvotes: 2

Related Questions