Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Referencing projects from other solutions in Visual Studio 2017

Recently I started messing with the xproj projects in Visual Studio 2015. While building a web app, I have a class library located in a different solution that I'm able to reference using a global.json file. I love this feature because you can build it all in one shot as opposed to switching between Visual Studio instances.

I find out now Microsoft is moving away from these projects and going back to the csproj way of doing things. I'm all about keeping up with best practices, but I can't seem to figure out how to bring external projects into a solution in the same way you can do it with the global.json. I'm also embarrassed to admit I can't seem to think of how to google for this.

Is there a new, recommended way of doing this in Visual Studio 2017?

like image 364
Chris Lees Avatar asked Nov 08 '22 00:11

Chris Lees


1 Answers

We can use the dotnet command line inteface to add an existing project...

to a project:

C:\temp\Bar> dotnet add .\Bar.csproj reference ..\Foo\Foo.csproj

to a solution:

C:\temp\Bar> dotnet sln .\Bar.sln add ..\Foo\Foo.csproj
like image 185
Shaun Luttin Avatar answered Nov 14 '22 21:11

Shaun Luttin