IbrarMumtaz IbrarMumtaz - 2 months ago 22
JSON Question

How to reference a specific version of NetStandard in project.json?

I am struggling to figure out how to force the npm (Nuget Package Manager) to resolve a specific version of the NetStandard1.X platform.

I am trying to use Serilog but the version of .NetStandard it supports is v1.3. Is there any way to force this behavior in the project.json file via some command or switch or option.

{
"version": "1.0.0-*",

"dependencies": {
"NETStandard.Library": "1.6.0",
"Serilog": "2.2.1"
},

"frameworks": {
"netstandard1.3": {
"imports": "dnxcore50",
"dependencies": {
}
}
}
}


When you specify v1.3, you end up with v1.6. Surely there must be a way of doing this? I am trying to upgrade an old .net framework 4.6 class library that was using log4net and I am struggling with the basics here.

Error Dump:

Package Serilog 2.2.1 is not compatible with netstandard1.6 (.NETStandard,Version=v1.6). Package Serilog 2.2.1 supports:
- net45 (.NETFramework,Version=v4.5)
- net46 (.NETFramework,Version=v4.6)
- netstandard1.0 (.NETStandard,Version=v1.0)
- netstandard1.3 (.NETStandard,Version=v1.3)
One or more packages are incompatible with .NETStandard,Version=v1.6.


DotNet Core Version Info:

Product Information:

Version: 1.0.0-preview2-003131

Commit SHA-1 hash: 635cf40e58

Answer

Your project.json restores on my machine correctly, so I would guess there is something wrong with packages/versioning.

Please try to change Serilog dependency version:

"Serilog": "2.3.0-dev-00711"

Or as you suggested yourself during our chat, move the decency into framework tag:

"frameworks": { 
    "netstandard1.6": { 
        "imports": "dotnet5.6", 
        "dependencies": { 
            "Serilog": "2.3.0-dev-00711" 
        } 
    } 
} 
Comments