Reputation: 1948
According to Mapping the .NET Platform Standard to platforms .NET Platform Standard 1.5 have to be compatible with .NET Framework 4.6.2. I have tried to use it (make new .NET Platform Standard class library, then new .Net Framework 4.6.2 console application), but the library is not recognized. What I am doing wrong?
project.json in class library:
{
"version": "1.0.0-*",
"dependencies": {
"NETStandard.Library": "1.5.0-rc2-24027"
},
"frameworks": {
"netstandard1.5": {
"imports": "dnxcore50",
"buildOptions": { "embed": "true" }
}
}
}
Upvotes: 0
Views: 2295
Reputation: 101
Do you really need .Net Framework 4.6.2 app?
I just created PCL (Portable class library) targeting .NETStandard1.4 and I can use it in WPF app which is targeting .NET Framework 4.6.1. Here is how my project.json looks like in PCL project:
{
"supports": {},
"dependencies": {
"Microsoft.NETCore.Portable.Compatibility": "1.0.1",
"NETStandard.Library": "1.6.0"
},
"frameworks": {
"netstandard1.4": {}
}
}
Upvotes: 0
Reputation: 5097
If you get the latest .net core RTM release and the Update 3 VS tooling, things are a little nicer than they were during the RC period. Still don't have easy project references from csproj referencing xproj - but, you can get things to talk by packing up the xproj output into a nuget package, then using the package manager to install that package. Also, you shouldn't need the imports on the framework, nor the dependency on netstandard.library, at least I don't. Here's how I've done it:
Create a .cmd file which will package the nuget files and two copy the output files to the folder where the package manager is expecting them. Here's that script, I call it makeNuget.cmd:
IF "%1" == "%2" (
dotnet pack --no-build --configuration %1 -o ../%3
xcopy %4 "...\%3\lib\%5\" /Y
)
Add a postbuild script in the project.json of the xproj to run the script
"scripts": {
"postcompile": [
"makeNuget.cmd %compile:Configuration% Release packages\%project:Name% %compile:OutputDir% %compile:TargetFramework%"
]
}
This should leave you with a nuget package in the packages\[projectName]\ folder at the root of your solution, with the binaries in the packages\[projectName]\lib\[targetFramwork]\ folder
AFAIK, that's as good as it gets at the moment.
Upvotes: 1