Launching the Dnx Console application with project dependencies as a global command

I have a DNX console application that references a class library project. I am trying to publish this and install it as a global team.

I am doing this on windows 10. Project tree

Console project Program.cs

 namespace Vert.Commands { public class Program { public static void Main(string[] args) { var test = new ConsoleWriter(); test.Talk("Test", ConsoleColor.Cyan); } } } 

Console project project.json

 { "version": "1.0.0-*", "description": "Test App", "authors": [ "vrybak" ], "tags": [ "" ], "projectUrl": "", "licenseUrl": "", "compilationOptions": { "emitEntryPoint": true }, "dependencies": { "CommandLib": "1.0.0-*" }, "commands": { "vm-test-job": "Vert.Commands" }, "frameworks": { "dnx451": {} } } 

Class Library: CommandLib File: ConsoleWriter

 namespace CommandLib { public class ConsoleWriter { public void Talk(string message, ConsoleColor color) { var currentColor = Console.ForegroundColor; Console.ForegroundColor = color; Console.WriteLine(message); Console.ForegroundColor = currentColor; } } } 

Class Library: project.json

 { "version": "1.0.0-*", "description": "CommandLib Class Library", "authors": [ "vrybak" ], "tags": [ "" ], "projectUrl": "", "licenseUrl": "", "frameworks": { "dnx451": { } } } 

I am trying to install the global command vm-test-job For this I

  • cd to src/Vert.Commands
  • publish it as a package
  • dnu publish --no-source -o artifacts\publish
  • cd \artifacts\publish\approot
  • dnu commands install .\packages\Vert.Commands\Vert.Commands.1.0.0.nupkg

When I try to run the vm-test-job command, I get the error System.IO.FileNotFoundException: Could not load file or assembly 'CommandLib, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified. System.IO.FileNotFoundException: Could not load file or assembly 'CommandLib, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.

How to install a command that is in a console application project that references other projects?

+7
c # dnx dnu
source share
1 answer

Have you tried to do ...

 dnu restore 

... before setting the command? I think dnvm needs to rebuild / repack your dependencies before installation.

Take a look at this link, which is trying to achieve the same as me. http://blogs.msdn.com/b/sujitdmello/archive/2015/04/23/step-by-step-installation-instructions-for-getting-dnx-on-your-laptop.aspx

+1
source share

All Articles