Reputation: 1864
I am having 3 solutions which
Solutions
Solution A
Project A1
is an extension project for System.Data.SqlClient classes (.NET Standard 2.0)Solution B
Project B1
is a library used to manage some instances (.NET Standard 1.0)Project B2
is a library used to manage the instances with the extended System.Data.SqlClient through Project A1
(.NET Standard 2.0)Solution C
Project C1
is a library depends on A1
and B1
(.NET Standard 2.0)Project C2
is 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)
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
Project A1
while I have already spent hours to ensure Solution B
and Solution C
loaded Solution A
from the same branch and version.Guids
Project A
of Solution A
: FD9834ED-3C94-4445-AE15-DFF0F5C42656Project A
of Solution A
with Solution B
's submodules folder: FD9834ED-3C94-4445-AE15-DFF0F5C42656Project A
of Solution A
: E0FEC3C6-42AB-47D9-912A-40B3C5D2BA66Project A
of Solution C
: 2A7E2981-87F6-40A5-86F4-D523EC1F68DBAny help will be appreciated
Upvotes: 1
Views: 2210
Reputation: 1864
After hours of research, it is confirmed a .NET mechanical issue which the same project is being saved across different location and be referenced by multiple other projects. Which .NET cannot recognize they are the same project even they are all cloned from git server and sharing the same name.
As jessehouwing
suggested (thanks for all your help jessehouwing!!) we could wrap all projects(submodules) into one giant solution for development (I guess this approach match perfectly the name solution)
However what we are trying to do is having the below architecture:
So finally I decided to go for an internal NuGet feed while VS2017 already could auto generate the nupkg file on build which has been tested and working perfectly as expected.
@jessehouwing you may answer the question and I would set yours as the answer, thanks again!
Upvotes: 2