c# - How to specify dependencies on other projects with .NET CLI? -
it common break large solution multiple projects question of organization of code base , done in earlier versions of .net framework inside visual studio.
how same can done .net cli? suppose have following simplified scenario example:
- solution folder - global.json - src - libproject - consoleproject suppose consoleproject depends on libproject. intuitively belive means in consoleproject project.json have contain dependencies section this:
"dependencies": { "microsoft.netcore.app": { "type": "platform", "version": "1.0.0-*" }, "libproject": "1.0.0-*" } but if this, when try restore dependencies consoleproject or when try build can't it. when try restore message
unable resolve 'libproject (>= 1.0.0)' '.netcoreapp,version=v1.0'.
i understand reason. when restoring, nuget trying find package on specified feeds on nuget.config. shouldn't this, should use 1 on sibling folder.
in previous versions of .net core, add reference through vs , then, if try build consoleproject, vs first build libproject , use corresponding dll.
how same kind of thing done here? how reference project in same solution , how restore/build/run .net cli considering kind of dependency?
after define projects solution have on global.json file can reference them on project.json name without specific version.
example:
global.json
{ "projects":[ "consoleproject", "libproject" ] } consoleproject/project.json
{ "dependencies":{ "libproject":"", } } you can find better example in here: http://forums.dotnetfoundation.org/t/referencing-another-project-in-net-core/1298/2
or in repository: https://github.com/cartermp/dnx-apps/tree/master/multiple-projects
Comments
Post a Comment