1

I have created a nuget package for my .net core class library.

below is my Project.json code for my nuget packaged class library

{
  "dependencies": {
    "NETStandard.Library": "1.6.0",
    "Newtonsoft.Json": "9.0.1",
    "System.Collections.NonGeneric": "4.0.1",
    "System.Dynamic.Runtime": "4.0.11",
    "System.IO.FileSystem.Watcher": "4.0.0",
    "System.Runtime.Loader": "4.0.0",
    "System.Threading.Thread": "4.0.0"
  },

  "frameworks": {
    "netstandard1.6": {
      "imports": "dnxcore50"
    }
  },
  "version": "1.0.0-*"
}

When I try to install this nuget package in another class library ,I'm getting the below error.

Retrieving package 'JsonConfig.Core 1.0.0' from 'Local Packages'.
Installing NuGet package JsonConfig.Core.1.0.0.
Successfully installed 'JsonConfig.Core 1.0.0' to ClassLibrary1
Executing nuget actions took 37.98 ms
========== Finished ==========
Time Elapsed: 00:00:02.8637585
PATH=.\node_modules\.bin;C:\Program Files (x86)\Microsoft Visual Studio 14.0\Web\External;%PATH%;C:\Program Files (x86)\Microsoft Visual Studio 14.0\Web\External\git
C:\Program Files\dotnet\dotnet.exe restore "C:\Users\sbonumaddi\Documents\Visual Studio 2015\Projects\TestNugetPackage\.vs\restore.dg"
log  : Restoring packages for C:\Users\sbonumaddi\Documents\Visual Studio 2015\Projects\TestNugetPackage\src\ClassLibrary1\project.json...
error: Package JsonConfig.Core 1.0.0 is not compatible with netstandard1.6 (.NETStandard,Version=v1.6). Package JsonConfig.Core 1.0.0 supports: net (.NETFramework,Version=v0.0)
error: One or more packages are incompatible with .NETStandard,Version=v1.6.
log  : Writing lock file to disk. Path: C:\Users\sbonumaddi\Documents\Visual Studio 2015\Projects\TestNugetPackage\src\ClassLibrary1\project.lock.json
log  : C:\Users\sbonumaddi\Documents\Visual Studio 2015\Projects\TestNugetPackage\src\ClassLibrary1\ClassLibrary1.xproj
log  : Restore failed in 387ms.
Errors in C:\Users\sbonumaddi\Documents\Visual Studio 2015\Projects\TestNugetPackage\src\ClassLibrary1\ClassLibrary1.xproj
    Package JsonConfig.Core 1.0.0 is not compatible with netstandard1.6 (.NETStandard,Version=v1.6). Package JsonConfig.Core 1.0.0 supports: net (.NETFramework,Version=v0.0)
    One or more packages are incompatible with .NETStandard,Version=v1.6.

Below is my nuget spec file

<?xml version="1.0"?>
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
    <metadata minClientVersion="3.2">
        <id>JsonConfig.Core</id>
        <version>1.0.0</version>
        <title>JsonConfig.Core</title>
        <authors>Satish Kumar B</authors>
        <owners>Satish Kumar B</owners>
        <licenseUrl>https://github.com/Dynalon/JsonConfig/blob/master/LICENSE.txt</licenseUrl>
        <projectUrl>https://github.com/satish049/JsonConfig</projectUrl>
        <requireLicenseAcceptance>false</requireLicenseAcceptance>
        <description>JsonConfig.Core is ported from JsonConfig by Timo Dörr. JsonConfig.Core is a simple to use configuration library, allowing JSON based config files for your C#/.NET Core application instead of cumbersome web.config/application.config xml files.

It is based on Newtonsoft.Json.Net and C# 4.0 dynamic feature. Allows putting your programs config file into .json files, where a default config can be embedded as a resource or put in the (web-)application folder. Configuration can be accessed via dynamic types, no custom classes or any other stub code is necessary.

JsonConfig brings support for config inheritance, meaning a set of configuration files can be used to have a single, scoped configuration at runtime which is a merged version of all provided configuration files.</description>
        <summary>simple configuration library using JSON and C# 4.0 dynamic feature and .Net Core</summary>
        <copyright>Copyright (c) 2012-2016 Timo Dörr,2016 Satish Kumar B</copyright>
        <tags>json, config, configuration,json .net core</tags>
        <dependencies>
            <dependency id="NETStandard.Library" version="1.6.0" />
            <dependency id="Newtonsoft.Json" version="9.0.1" />
            <dependency id="System.Collections.NonGeneric" version="4.0.1" />
            <dependency id="System.Dynamic.Runtime" version="4.0.11" />
            <dependency id="System.IO.FileSystem.Watcher" version="4.0.0" />
            <dependency id="System.Runtime.Loader" version="4.0.0" />
            <dependency id="System.Threading.Thread" version="4.0.0" />
        </dependencies>
    </metadata>
    <files>
        <file src="bin\Debug\netstandard1.6\JsonConfig.Core.dll" target="lib\netstandard1.6\JsonConfig.Core.dll" />
        <file src="bin\Debug\netstandard1.6\JsonConfig.Core.pdb" target="lib\netstandard1.6\JsonConfig.Core.pdb" />
    </files>
</package>

EDIT 1---

Below is the Project.json for the class library where I'm trying to install this package

{
  "version": "1.0.0-*",

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

  "frameworks": {
    "netstandard1.6": {
      "imports": "dnxcore50"
    }
  }
}

Could somebody please help me fix this issue.

Satish Kumar
  • 203
  • 3
  • 8
  • Please provide `project.json` of the other library too. – Deilan Nov 15 '16 at 07:32
  • @Deilan Added the `project.json` of the other class library. Thanks. – Satish Kumar Nov 15 '16 at 11:49
  • The problem is in dependency from `JsonConfig.Core` NuGet package. But I don't see it as a declared dependency anywhere among dependencies in the provided `project.json` files. Where do you reference it? Maybe somewhere in other project in the solution? – Deilan Nov 15 '16 at 12:00
  • @Deilan I'm trying to install the package to add it as a reference. But I keep getting the above mentioned error. It is not working even if I add it manually under the Project.json. – Satish Kumar Nov 15 '16 at 17:42

0 Answers0