1

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)

  • 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 A1 while I have already spent hours to ensure Solution B and Solution C loaded Solution A from the same branch and version.

Update

Guids

  • Project A of Solution A: FD9834ED-3C94-4445-AE15-DFF0F5C42656
  • Project A of Solution A with Solution B's submodules folder: FD9834ED-3C94-4445-AE15-DFF0F5C42656
  • Project A of Solution A: E0FEC3C6-42AB-47D9-912A-40B3C5D2BA66
  • Project A of Solution C: 2A7E2981-87F6-40A5-86F4-D523EC1F68DB

Any help will be appreciated

12
  • It would help to know the VS version you are using. In addition, this kind of questions (specially on closed source software) is usually best left to the vendor, i.e. developercommunity.visualstudio.com See also learn.microsoft.com/en-us/visualstudio/ide/… Commented Apr 12, 2019 at 10:07
  • It is VS2017 Professional, thanks Commented Apr 12, 2019 at 10:08
  • Solutions aren't referenced, Projects are. In Solution B or C, are you using project references or binary references. If using project references, are all indirect refereces part of Solution B or C? Commented Apr 12, 2019 at 10:22
  • Sorry my bad, yes solution A, B, C should be Project A, B, C. I am using project reference to the .csprj files. Project A need nothing other than .NET Standard 1.0 to compile while project B need Project A and NuGet package System.Data.SqlClient to compile for .NET Standard 2.0. Project C depends on Project A and B and System.Data.SqlClient (already installed) for .NET Standard 2.0. Commented Apr 12, 2019 at 10:30
  • 1
    Ahh now I see the issue. In your solution tree the SAME solution+project is included multiple times. That doesn't work! It never will. The recommendation is to create a single top level parent Git repo, mount each submodule project into it, keep a single solution file in the root Git repo only. Optionally create multiple of these root projects. Commented Apr 12, 2019 at 14:06

1 Answer 1

2

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:

  • Cores.Library
  • ACompany.Cores.Library
  • ACompany.Cores.Web
  • BCompany.Cores.Library1
  • BCompany.Cores.Library2
  • BCompany.Cores.Console
  • BCompany.Cores.Web

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!

Sign up to request clarification or add additional context in comments.

1 Comment

Hi Zay, thank you for your sharing and so glad to hear that your issue is solved. Please mark your reply as answer when you have free time, that will help others to easier search this useful information.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.