Tom Schardt
Tom Schardt

Reputation: 498

How to create portable code (.net standard 2.0) for a Raspberry Pi 3 using Windows 10 IoT (UWP)?

I want to port an app to run on the Raspberry Pi 3.

For the app I think I am forced to use UWP, but I don´t want to use UWP libraries. I think it is a good idea to use .NET Standard 2.0 libraries.

My questions:

Upvotes: 1

Views: 759

Answers (2)

Tom Schardt
Tom Schardt

Reputation: 498

now as the fall creators update is available I solved this task like follows:

  • App / Entry point is an UWP application
  • DLL / Libraries are .net standard 2.0
  • unit tests are created with 'add new xunit'
  • IoC is done with CompositionRoot pattern using AutoFac container (also .net standard dll)

Everything is working now so far. For sourcecode visit https://github.com/thosch1800/TT4-to-Garmin

Upvotes: 1

Michael Xu
Michael Xu

Reputation: 4432

  • Is this the right way to get a portable code base?

Yes, you can create a .net standard library as a reference for your UWP project. Moreover, considering portable in windows 10 platform scope, Windows Runtime components is a better choice, the advantage is that it can support any language, including C#, Visual Basic, JavaScript, and C++.

  • Will UWP App with .net standard 2.0 libraries work?

Currently UWP support .net Standard 1.4. Please reference here https://learn.microsoft.com/en-us/dotnet/standard/net-standard .

UWP support .NET Standard 2.0 is work in progress and will ship later this year.

  • Do .net standard 2.0 libraries support normal (non-UWP) unit tests?

Yes, it supports unit test of Unit Test Project or NUnit 3 Test Project

  • Has someone experience with such a configuration?

When creating a unit test project for UWP library project, it indeed forces to create an Unit Test App(Universal Windows). I tried to create a NUnit 3 Test Project (Universal Windows), there was an exception such as "Unspecified error(Exception from HRESULT:0x80004005(E_FAL))". Please reference here to get more information: http://krzyskowk.postach.io/post/unit-tests-in-uwp.

Upvotes: 0

Related Questions