Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reference Project outside of the solution shows error NU1105 #9452

Closed
TFTomSun opened this issue Apr 18, 2020 · 5 comments
Closed

Reference Project outside of the solution shows error NU1105 #9452

TFTomSun opened this issue Apr 18, 2020 · 5 comments
Labels

Comments

@TFTomSun
Copy link

TFTomSun commented Apr 18, 2020

In the past, it was possible to reference projects outside of the solution. At the moment it seems not to be possible. I read #5820, there seems to be some activity to make that possible again. Which Visual Studio Version do I need to test it? What are the limitations?

@nkolev92
Copy link
Member

Visual Studio 2019 has this functionality.

I'd think about it the other way around though.
All the projects that currently in the solution need to have been restore and built succesfully on the commandline( or in a solution where all the projects are available).

On a technical level, both restore and build will use assets from that project's obj/bin directories.

So say you have:
A, B, C, D in the repo.
The refs are:
A => B
A => C
C => D

Say you want A & B in a solution. You need to have restored and built A from a context where C & D are available (commandline or VS with all projects).

Hope this helps.

@nkolev92
Copy link
Member

In general, maybe this scenario deserves some docs, but the solution filters feature covers it well, because they talk about one complete solution and filters on top of it.

@TFTomSun
Copy link
Author

TFTomSun commented Apr 21, 2020

My scenario is a bit different. I want to bring projects from different repositories together to make cross repository changes and refactorings. For that I have a build SDK, which is referenced by all projects, that can replace the package references with project references dynamically. That works already well for all package references to projects that are within the current solution. For the cross solution references I was hoping, that given a common root directory, I can simple replace the package references with project references that point to projects outside of the currently opened solution and it will build.

I tried what you said in Visual Studio 2019 (16.5 Preview 5), but even when I build the Solution A with Project A one time, I couldn't build Solution B with Project B which references Project A. Would that be a bug then? Or did I do something wrong?

Another approach would be to create temporary solutions for those scenarios. But that's a bit ugly, because I would have to trace through all dependencies recursively and generate solutions with all projects that are within my common "scope" ... These kind of solutions couldn't be checked in anywhere... because there's no repository where they would belong to.

@TFTomSun
Copy link
Author

@nkolev92 I would like to propose a feature for the "multiple repositories" scenario I described above:

  • Solutions dynamically add all project references that are defined by MSBuild in the evaluation phase -> these external projects will not be written into the solution file, its just a dynamic behavior

  • the projects that are not defined in the solution, are not loaded by default - means they are deactivated via the solution filter concept

@nkolev92
Copy link
Member

@TFTomSun I'd file an issue https://developercommunity.visualstudio.com/spaces/8/index.html for that.

NuGet doesn't own that problem space.

As far as NuGet & unloaded projects go, you need to have a project restore in order for it to work.

Closing this as question, thank you for your feedback.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants