使用 UWP 库的 WPF 应用,"could not load file or assembly"

WPF app using UWP libraries, "could not load file or assembly"

我目前正在一个现有的 WPF 应用程序中实现 BLE 支持。由于没有官方支持,我决定尝试破解 UWP API。我在 visual studio 2017 年工作。

当我创建一个新的 WPF 应用程序并使用我的 class 库时,一切正常,但是当我尝试在现有应用程序中实现它时,我为每个调用的 uwp api 收到以下错误.

Problem generating manifest. Could not load file or assembly 'Path\to\project\bin\Debug\Windows.UI.Core.AnimationMetrics.AnimationMetricsContract.winmd' or one of its dependencies. An attempt was made to load a program with an incorrect format.

查看 Whosebug 上的其他线程,我发现这可能是他们添加的 clickonce 发布的问题

<TargetPlatformVersion>8.0</TargetPlatformVersion>

添加到 class 库 .csproj 文件,但我应该在哪里添加它? 在 class 库 .csproj 中我只看到行

<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>

有人知道我如何编译它吗?

最后我遍历了所有项目并找到了一个使用 clickonce 分发的项目。

在 之后,我编辑了 .Csjproj 文件并进行了更改

<GenerateManifests>true</GenerateManifests>

<GenerateManifests>false</GenerateManifests>

瞧瞧我编译的项目