How to use PCL in ASP.NET Core 1.0 RC2 project
N

1

3

I want to use a simple (POCO only without other dependencies) PCL with targets

  • Xamarin.Android
  • Universal Windows 10
  • ASP.NET Core 1.0

in an ASP.NET Core 1.0 RC2 project (all in the same solution). I have added this import to my project.json:

"frameworks": {
  "netcoreapp1.0": {
    "imports": [
      "dotnet5.6",
      "dnxcore50",
      "portable-net451+win8"
    ],
    "dependencies": {
      "PCL.Library": {
        "target": "project"
      }
    }
  }
}

I don’t get any errors (compilation or otherwise) and the PCL.Library project shows up in the references (without warning signs or anything). But I can’t use it in my ASP.NET Core 1.0 RC2 project because the using statements don’t resolve as if the PCL was not referenced at all.

How do I have to configure my PCL project and my ASP.NET Core project so that I can use the PCL?

Update: it does not work with the RTM version either. No reponse from the dev team on the GitHub issue leaves me thinking there is a fundamental issue making this impossible.

Noodlehead answered 17/5, 2016 at 11:1 Comment(0)
R
2

I believe this is related to: https://github.com/aspnet/Home/issues/1356

It might be best to follow up on this issue tracker and ask for the current status although it says it will be supported in RC2.

This is part of the whole .NET platform standardization via the netstandard(https://github.com/dotnet/corefx/blob/master/Documentation/architecture/net-platform-standard.md)

You can read more about this here:

http://damien.dennehy.me/blog/2016/01/15/class-library-packages-future-class-libraries/

Note: There's a doc I found today regarding targeting a PCL:

http://dotnet.github.io/docs/core-concepts/libraries/libraries-with-cli.html#how-to-target-a-portable-class-library-pcl

Reprise answered 17/5, 2016 at 23:17 Comment(1)
Ah, I was hoping it would work with RC2. Added my voice to the issue so let's wait and hope for the fixes to come :)Noodlehead

© 2022 - 2024 — McMap. All rights reserved.