Nuget depends on this singular file, to be in the same directory as the project. This means if there are two projects in one directory, they will conflict.
How can I make nuget stop relying on this horrible file?
Nuget depends on this singular file, to be in the same directory as the project. This means if there are two projects in one directory, they will conflict.
How can I make nuget stop relying on this horrible file?
Ideally, 2 projects should be in 2 different folders.
For example, I have ASP.NET Core application (based on project.json) and class library (based on project.json) then my folder structure looks like this-
Solution Level Folder (Here you will .sln
file and below src
folder)
src folder
ASP.NET Core application folder (Here you will have main project.json)
Class Library folder (Here you will have class library project.json)
This way, it will not affect each other.
Other option is to rename project.json
to {project-name}.project.json
This prevents potential conflict in Visual Studio when trying to restore packages for the libraries in the same directory.
For more information on this, refer NuGet FAQ-
I have multiple projects in the same folder, how can I use separate packages.config or project.json files for each project?
In most projects where separate projects live in separate folders, this is not a problem as NuGet will identify the packages.config and project.json files in each project. With NuGet 3.3+ and multiple projects in the same folder, you can insert the name of the project into the packages.config or project.json filenames as below and NuGet will use that file:
packages.config
: use the patternpackages.{project-name}.config
project.json
: use the pattern{project-name}.project.json