(Now raised as DNX issue 3206...)
DNX environment: 1.0.0-rc1, Windows 10 x64.
Imagine I have three solutions:
Each of these solutions has multiple projects in; it wouldn't make sense to have all the projects in a single solution, even though that would simplify this particular issue.
Various projects in Application1 and Application2 depend on a project in Common. Their project.json
files indicate that dependency in a normal way. While eventually I'd like to publish the artifacts from Common to a NuGet server (internal or external), it makes sense to temporarily just build everything from source.
I can do that by editing global.json
within (say) Application1 to have:
{
"projects": [ "src", "test", "../Common/src" ],
"sdk": { "version": "1.0.0-rc1-final" }
}
With that in place, I can perform a dnu restore
from the Application1 directory... but not from the root directory. (The error is "Unable to locate Dependency 'Common' >= 0.0.0-*".) I can run dnu restore Application1
from the root directory, but not just dnu restore
.
I've tried numerous ways to refer to the Common src directory (including "./Common/src", "Common/src", "../repo-name/Common/src"), but haven't had any joy yet. In every case, I get the error message shown above. I've tried using dnu -v restore
but that didn't appear to give any extra information about which directories were being probed for source-based packages.
So, how should the "../Common/src"
be resolved in global.json
? Is this a resonable approach to the development scenario I've described, and if so is it just a matter of filing a bug against DNX?
It doesn't work the way you expect it, when you start dnu restore
it tries to find global.json
in current or parent directories, and reads project path from it. So in your example it doesn't read anything because global.json
is in sub-directory.
One way to solve this problem is to add global.json
to root folder with the following content:
{
"projects": [ "Application/src", "Common/src" ]
}
I will ask around about this scenario and if it might change when moving to dotnet cli