.NET Core Solution of multiple projects

.NET Core is using file-system to organize projects. Sometimes the working project is getting quite big and it makes sense to organize it in multiple sub-folders. The problem what I encountered was with the local dependencies. In .NET and Visual Studio it is straight forward to reference projects across a solution. There is something similar in .NET Core - it is global.json file, which acts as a solution for organizing multiple projects.

Note:The functionality of global.json will change in the next release and it will not be used for managing the solution’s projects. At the moment this works in .NET Core 1.0.0 Preview 2

|Demo_Project
|--src
|----Core
|------SDK
|----Plugins
|------HelloPlugin
|--global.json

This is our project. The global.json file must exists in the root directory, thus in this case it will be besides src folder. The HelloPlugin needs to reference SDK library. Without global.json it is not possible to reach SDK library from there. To make SDK available to HelloPlugin we need to specify Top-Level folder where to find project folders. The scan of project folders will happen at the top-level. If there is a project in a sub-folder and it is not referenced in global.json, it will be ignored.

{
    "projects": [ 
        "src/Core", 
        "src/Plugins" ]
}

In this case we add two paths, where to look for project folders.

comments powered by Disqus