gilmishal
gilmishal

Reputation: 1992

Error targeting .net core RC2 and .net4.6.1

I have the following project.json:

{
"version": "1.0.0-*",

  "dependencies": {
    "NETStandard.Library": "1.5.0-rc2-24027",
    "Dapper": "1.50.0-rc2b",
    "Microsoft.Extensions.DependencyInjection": "1.0.0-rc2-final",
    "System.Dynamic.Runtime": "4.0.11-rc2-24027",
    "Microsoft.CSharp": "4.0.1-rc2-24027"
  },

  "frameworks": {
    "netstandard1.5": {
      "imports": "dnxcore50"
    },
    "net461": {}
  }
}

now, I am getting the following warnings, that I would rather not have

Dependency specified was System.Dynamic.Runtime >= 4.0.11-rc2-24027 but ended up with System.Dynamic.Runtime 4.0.10.0.

Dependency specified was Microsoft.CSharp >= 4.0.1-rc2-24027 but ended up with Microsoft.CSharp 4.0.0.0.

dropping the net461 from the frameworks solves my issue - but is not a prefered choice.

However, now I can guess why I am getting them, something to do with those libraries not supporting net461 - although it seems kinda odd to me.

I tried just using the older version - but then I get a warning that Dapper expected a newer version of those - any Ideas?

for some reason, moving dependencies to each framework specifically (same versions) solves this issue too

Upvotes: 4

Views: 313

Answers (1)

Ivan Prodanov
Ivan Prodanov

Reputation: 35522

The framework-specific dependencies should be specified within the framework-specific element. Like so:

{
  "version": "1.0.0-*",

  "dependencies": {
    "Dapper": "1.50.0-rc2b",
    "Microsoft.Extensions.DependencyInjection": "1.0.0-rc2-final",
    "System.Dynamic.Runtime": "4.0.11-rc2-24027"
  },

  "frameworks": {
    "netstandard1.5": {
      "dependencies": {
        "NETStandard.Library": "1.5.0-rc2-24027"
      },
      "imports": "dnxcore50"
    },
    "net461": {
      "dependencies": {
        "Microsoft.CSharp": "4.0.1-rc2-24027"
      }
    }
  }
}

Upvotes: 2

Related Questions