sdk: Unable to include project reference to CLI tool

Steps to reproduce

Create two .NET Core projects

  • Class library representing the tool (DemoTool) – Add Program.cs with Main(string[] args) => Console.WriteLine("Hello World");
{
  "title": "Demo Tool",
  "version": "0.1.0-*",

  "buildOptions": {
    "emitEntryPoint": true,
    "outputName": "dotnet-demo-tool"
  },

  "dependencies": {
  },

  "frameworks": {
    "netcoreapp1.0": {
      "imports": "portable-net452+win81",
      "dependencies": {
        "Microsoft.NETCore.App": {
          "version": "1.0.0-rc2-3002702",
          "type": "platform"
        }
      }
    }
  }
}
  • Console application representing the app (DemoApp) referencing the tool

Configure a project reference to the tool

{
  "title": "Demo Tool",
  "version": "0.1.0-*",

  "buildOptions": {
    "emitEntryPoint": true
  },

  "tools": {
    "DemoTool": {
      "version": "0.1.0-*"
    }
  }

  "frameworks": {
    "netcoreapp1.0": {
      "imports": "portable-net452+win81",
      "dependencies": {
        "Microsoft.NETCore.App": {
          "version": "1.0.0-rc2-3002702",
          "type": "platform"
        }
      }
    }
  }
}

Execute dotnet restore

Expected behavior

dotnet restore executes successfully.

dotnet demo-tool executes successfully and “Hello World” is written to the console output.

Actual behavior

dotnet restore fails:

Unable to resolve ‘DemoTool (>= 0.1.0)’ for ‘.NETCoreApp,Version=v1.0’.

Environment data

dotnet --info output:

.NET Command Line Tools (1.0.0-preview1-002702)

Product Information:
 Version:     1.0.0-preview1-002702
 Commit Sha:  6cde21225e

Runtime Environment:
 OS Name:     Windows
 OS Version:  10.0.10586
 OS Platform: Windows
 RID:         win10-x64

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Reactions: 2
  • Comments: 18 (5 by maintainers)

Most upvoted comments

@Antaris @GrantErickson this is not supported for RC2. You have to package your tool as a Nuget package. However, you don’t have to have a feed, you can restore it using the -f switch to dotnet restore.

We are thinking about whether to add this feature going forward.

@BrainCrumbz in order not to litter this issue with unrelated comments, I’ve moved that discussion to an issue on my repo: https://github.com/liamdawson/DotNet.DevFeed/issues/4

Risking a plug here, but you might find this helpful when trying to write/debug tools (or anything that benefits from a local auto-refreshing nuget feed). Feedback/contributions welcome.

https://github.com/liamdawson/DotNet.DevFeed/

I am suprised there isn’t currently a debug story for tools in dotnet-cli preview1. How does the ASP.NET and .NET teams develop their tools? Like, the user-secrets, and iis tooling? Do you dotnet pack & dotnet restore for every code change?

Thanks for the update. Good to know I can stop looking. I would definitely vote for a better debug story going forward.