I have a test utilities project (call it Utilities.Test
) that specifies a nuget package as development dependency in its project.json
file:
{
"dependencies": {
"devdep": {
"version": "*",
"type": "build"
}
},
"frameworks": {
"net45": {}
},
"supports": {},
"runtimes": {
"win": {}
}
}
I package Utilities.Test
as a nuget package and attempt to consume it in a test application (call it MyProject.Test
), specifying the version as a floating value in the MyProject.Test
project.json
file:
{
"dependencies": {
"utilities.test": {
"version": "*",
"type": "build"
}
},
"frameworks": {
"net45": {}
},
"runtimes": {
"win": {}
}
}
When I do this, I get the following compilation error: "Unable to resolve devdep (>= x.x.x) for .NETFramework, Version=4.5"
. I've found two ways to resolve the issue:
- Include
devdep
as a reference (with floating version) in theMyProject.Test
project.json
file as well. - Specify a concrete version number for
Utilities.Test
in theMyProject.Test
project.json
file.
Neither of these solutions is acceptable. I thought the whole point of specifying a package as a development dependency was to prevent it from being captured as an install dependency. How do I prevent devdep
from being proliferated as a dependency when using floating versions?
I solved this by adding
<developmentDependency>true</developmentDependency>
to the nuspec file forUtilities.Test
. This was already specified in the .nuspec file fordevdep
, so I'm unclear why that would be insufficient to prevent its proliferation. Also totally unclear now what the purpose of the"type": "build"
tags in theproject.json
are for - would welcome any insight on these two questions.