Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I declare a development dependency in project.json?

In my project.json, I need to refer to a library that I'm using during development, but don't want included in the project output. This is common for things like static analyzers and other tools.

Before project.json, this was handled by a metadata tag in the package .nuspec file. But, this no longer works (as far as I know) for projects following the new JSON standard.

How do I declare a development-only dependency in the new standard?

like image 230
Nate Barbettini Avatar asked Dec 13 '25 02:12

Nate Barbettini


1 Answers

As of 1.0.0-rc1, the correct syntax is:

"dependencies": {
    "HelloShared": { 
        "version": "0.1-beta-*",
        "type": "build"
    }
},

This declares HelloShared as a build (development-only) dependency of the current project.

I found this example in dnx/samples/HelloWorld/project.json on Github.

like image 102
Nate Barbettini Avatar answered Dec 15 '25 14:12

Nate Barbettini



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!