0

I have a solution with some projects:

  • client app - UWP project
  • device sdk - UWP project (because of bluetooth APIs)
  • client app - ASP.Net Core 1.1 targeting .Net Core 2.0
  • client app plugins
  • some projects with shared model and interface classes.

I would like to use .net standard projects as much as possible (for the shared projects and preferably for the plugins) because they are more lightweight and can be edited without unloading them in Visual Studio for example.

Referencing .net standard 1.4 libraries FROM an UWP project goes fine, but referencing an UWP project FROM a .net standard 1.4 project results in an error:

Project DeviceSDK is not compatible with netstandard1.4 (.NETStandard,Version=v1.4). Project DeviceSDK supports: uap10.0.15063 (UAP,Version=v10.0.15063) 

Is this is there any workaround for this?

3 Answers 3

5

That's simply impossible. A cross platform library won't be able to reference a platform specific one.

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

1 Comment

Sounds logical, I'll try then to refactor an interface of the device SDK out of that package and create a net standard DeviceSdk.Interfaces project for it that the others can reference.
0

I refactored the interfaces and data models of the device SDK out of that project and create a .net standard DeviceSdk.Core project. This project can then be referenced from application logic projects and the DeviceSdk main project.

So the structure becomes roughly:

  • ClientApp - UWP project, referencing all projects but the ClientApp.Frontend project
  • DeviceSdk - UWP project (because of bluetooth APIs), referencing DeviceSdk.Core
  • DeviceSdk.Core - .net standard 1.4
  • ClientApp.Frontend - ASP.Net Core 1.1 targeting .Net Core 2.0, referencing ClientApp.Core
  • ClientApp.Plugins - .net standard 1.4, referencing ClientApp.Core and DeviceSdk.Core
  • ClientApp.Core (some projects with shared model and interface classes) - .net standard 1.4

Comments

0

.net standard class library can't reference UWP libs. That would break the whole concept of .net Standard.

The idea is that a class library that targets specific .net standard version can only reference limited set of APIs defined by the standard.

For example, .net standard v1.4 only allows API-s listed within this file: https://github.com/dotnet/standard/blob/master/docs/versions/netstandard1.4_ref.md

This list is frozen and is supposed to remain intact.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.