This does work in Visual Studio 2015 Update 3, but your project.json
isn't quite right.
Instead of adding net462
to the imports
section, it should be in the frameworks
section:
"frameworks": {
"net461": { },
"netcoreapp1.0": {
"dependencies": {
"Microsoft.NETCore.App": {
"type": "platform",
"version": "1.0.0"
}
}
}
}
Notice that the Microsoft.NETCore.App
dependency also needs to be moved into the netcoreapp1.0
section. That's because this dependency is only required when compiling as a .NET Core application.
The reference to your .NET 4.6.2 library is then simply part of your dependencies
section:
"dependencies": {
(...)
"Microsoft.Extensions.Options.ConfigurationExtensions": "1.0.0",
"MyLibrary": {
"target": "project"
}
}
By structuring it this way, I was able to reference and use classes in my .NET 4.6.2 library without any problems.
For reference, here's the entire working project.json
I used:
{
"dependencies": {
"Microsoft.AspNetCore.Mvc": "1.0.0",
"Microsoft.AspNetCore.Server.IISIntegration": "1.0.0",
"Microsoft.AspNetCore.Server.Kestrel": "1.0.0",
"Microsoft.Extensions.Configuration.EnvironmentVariables": "1.0.0",
"Microsoft.Extensions.Configuration.FileExtensions": "1.0.0",
"Microsoft.Extensions.Configuration.Json": "1.0.0",
"Microsoft.Extensions.Configuration.CommandLine": "1.0.0",
"Microsoft.Extensions.Logging": "1.0.0",
"Microsoft.Extensions.Logging.Console": "1.0.0",
"Microsoft.Extensions.Logging.Debug": "1.0.0",
"Microsoft.Extensions.Options.ConfigurationExtensions": "1.0.0",
"MyLibrary": {
"target": "project"
}
},
"frameworks": {
"net461": { },
"netcoreapp1.0": {
"dependencies": {
"Microsoft.NETCore.App": {
"type": "platform",
"version": "1.0.0"
}
}
}
},
"version": "1.0.0-*"
}
netcoreapp1.0
or only fornet461
? – Plourde