0

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" }
        }
    }
}
7
  • Does it need to be netstandard1.6 TFM (target framework moniker) Commented May 27, 2016 at 12:05
  • Sorry, it is .Net 4.6.2. What should I have in "frameworks" in project.json? Commented May 27, 2016 at 12:07
  • 1
    Can you share both project.json files? Commented May 27, 2016 at 12:09
  • @DavidPine The .Net Framework 4.6.2 is normal application, not .net Core Commented May 27, 2016 at 12:14
  • 1
    I think you're stuck targeting net46 for now Commented May 27, 2016 at 12:15

2 Answers 2

1

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

  • Now, you need to add the packages folder as a package source, so first open the package manager console, then click the little gear to add a package source (or Ctrl+Q, package sources, Enter). Then click the add button, name this source, browse or type in the packages directory and hit ok. enter image description here
  • In the package manager console, make sure both your package source and project are selected in the drop downs at the top.
  • install-package [your package name]

AFAIK, that's as good as it gets at the moment.

Sign up to request clarification or add additional context in comments.

Comments

0

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": {}
  }
}

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.