I am having 3 solutions which
Solutions
Solution A
Project A1is an extension project for System.Data.SqlClient classes (.NET Standard 2.0)
Solution B
Project B1is a library used to manage some instances (.NET Standard 1.0)Project B2is a library used to manage the instances with the extended System.Data.SqlClient throughProject A1(.NET Standard 2.0)
Solution C
Project C1is a library depends onA1andB1(.NET Standard 2.0)Project C2is a NUnit Test depends on all project above (.NET Core 2.2)
File Structure
The Solutions/Projects are imported through Git submodules where the structure as below:
- \
--- \Solution C
------ \Project C1
------ \submodules
--------- \Solution A
------------ Project A1
--------- \Solution B
------------ \Project B1
------------ \Project B2
------------ \submodules
--------------- \Solution A
------------------ \Project A1
Issue
While I use Visual Studio to open Solution C and compile the projects inside, the results are various: (note: I didn't include \Solution C\submodules\Solution B\submodules\Solution A\Project A1 in the solution since VS not allow 2 projects with same name)
- Project A1: ok
- Project B1: ok
- Project B2: not ok
- Project C1: ok
- Project C2: not ok
VS always said Project B2 cannot find the Project A1 (which path is \Solution C\submodules\Solution B\submodules\Solution A\Project A1), unless I right click on Project A1 and select clean, then rebuild Project B2 (clean is a must), below is the message:
Error NU1105 Unable to find project information for '\Solution C\submodules\Solution B\submodules\Solution A\Project A.csproj'. Inside Visual Studio, this may be because the project is unloaded or not part of current solution. Otherwise the project file may be invalid or missing targets required for restore.
However I tried to clone only Solution B to a new position (with submodules Solution A) and it can be compile and run as expected.
Guesses
- As suggested by @jessehouwing , this may be not a Git issue but Visual Studio, I guess it is due to VS is compiling the projects with 2 version of
Project A1while I have already spent hours to ensureSolution BandSolution CloadedSolution Afrom the same branch and version.
Update
Guids
Project AofSolution A: FD9834ED-3C94-4445-AE15-DFF0F5C42656Project AofSolution AwithSolution B's submodules folder: FD9834ED-3C94-4445-AE15-DFF0F5C42656Project AofSolution A: E0FEC3C6-42AB-47D9-912A-40B3C5D2BA66Project AofSolution C: 2A7E2981-87F6-40A5-86F4-D523EC1F68DB
Any help will be appreciated