如何使用 Windows 10 IoT (UWP) 为 Raspberry Pi 3 创建可移植代码(.net 标准 2.0)?

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

我想在 Raspberry Pi 上将应用移植到 运行 3.

对于应用程序,我认为我被迫使用 UWP,但我不想使用 UWP 库。我认为使用 .NET Standard 2.0 库是个好主意。

我的问题:

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

是的,您可以创建一个 .net 标准库作为您的 UWP 项目的参考。而且,考虑到在windows10平台范围内的可移植性,WindowsRuntime组件是更好的选择,优点是它可以支持任何语言,包括C#、Visual Basic、JavaScript和C++ .

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

目前 UWP 支持 .net Standard 1.4。请参考这里 https://docs.microsoft.com/en-us/dotnet/standard/net-standard .

UWP 支持 .NET Standard 2.0 正在进行中,将于今年晚些时候发布。

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

是的,支持Unit Test Project或NUnit 3 Test Project的单元测试

  • Has someone experience with such a configuration?

在为 UWP 库项目创建单元测试项目时,确实会强制创建单元测试应用程序(通用 Windows)。我试图创建一个 NUnit 3 测试项目(通用 Windows),出现了诸如“Unspecified error(Exception from HRESULT:0x80004005(E_FAL))”。请参考此处以获取更多信息:http://krzyskowk.postach.io/post/unit-tests-in-uwp.

现在秋季创作者更新可用,我解决了这个任务如下:

  • 应用程序/入口点是 UWP 应用程序
  • DLL/库是 .net 标准 2.0
  • 单元测试是用 'add new xunit'
  • 创建的
  • IoC 使用 AutoFac 容器(也是 .net 标准 dll)通过 CompositionRoot 模式完成

目前一切正常。 如需源代码,请访问 https://github.com/thosch1800/TT4-to-Garmin