C#+ UWP+控制台应用程序+ MSVS2017 =不(总是)工作

发布于 2025-02-11 02:58:36 字数 780 浏览 1 评论 0原文

我的互联网搜索使我在C#中下载了UWP控制台应用程序的项目模板,该模板在VS2019中完美工作,但不幸的是,我们的构建计算机使用VS2017,我被迫“降级”(即再次设置该项目)该版本。

该应用程序不是很复杂。它连接到BLE设备,注册到特定特征,将接收到的数据打印并通过TCP/IP将其发送到服务器以进行可视化。总共不到700行代码。对于蓝牙和TCP/IP的使用,我在清单中找到了几个复选框,我启用了这些复选框。

在VS2017中编译似乎是一卷骰子,但我想我现在已经找到了模式。释放模式(无论是X86还是X64)永远不会起作用。它给了我168个错误,其中100多个是“加载组件” xxx.dll“失败。system.io.io.filenotfoundException:无法加载文件或汇编'system.private.corelib,版本= 4.0.0.0 = B03F5F7F11D50A3A'或其依赖项之一。 100个不同的xxx.dlls,始终与system.private.corelib有关。

在调试模式下,这是一个不同的故事。第一次尝试失败了,只有一个xxx.dll(system.runtime.dll,并且仍然与system.private.corelib)有关,但是当我执行“干净解决方案”并再次编译时,编译和链接就会成功。我是否再次清理并编译,此错误再次弹出。再次清洁和编译? - >错误消失了。似乎在成功与失败之间ping pond ad ad infinitum。

任何其他相关信息都可能是最低和目标Windows版本是2004(10.0,Build 19041)。

恐怕我所处的情况非常具体,因此我找不到解决方案,但也许这里有人可以提供帮助。

My internet searches have led me to downloading the project templates for UWP Console applications in C#, which work perfectly in VS2019, but unfortunately our build machine uses VS2017 and I am forced to "downgrade" (i.e. setup the project again) for that version.

The application is not extremely complicated. It connects to a BLE device, registers to a specific characteristic, prints the received data and also sends it through TCP/IP to a server for visualization. All in all less than 700 lines of code. For the usage of Bluetooth and TCP/IP I have found a couple of checkboxes in the manifest, which I enabled.

Compiling in VS2017 seemed like a roll of the dice, but I think I have found the pattern now. Release mode (whether it is for x86 or x64) will never work. It gives me 168 errors of which over 100 are "Loading assembly "XXX.dll" failed. System.IO.FileNotFoundException: Could not load file or assembly 'System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.". 100 different XXX.dlls, always related to System.Private.CoreLib.

In debug mode, it is a different story. The first attempt fails, with only one XXX.dll (System.Runtime.dll, and still related to System.Private.CoreLib), but when I do a 'Clean Solution' and compile again, compiling and linking succeeds. Do I clean and compile again, the error pops up again. Clean and compile again? -> Error gone. It seems to ping-pong ad infinitum between success and failure.

Any other relevant information may be that the minimum and target Windows versions are 2004 (10.0, build 19041).

I am afraid the situation I am in is very specific and therefore I can't find a solution, but maybe someone here is able to help.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

許願樹丅啲祈禱 2025-02-18 02:58:36

感谢Roy Li指出,该项目模板的最低版本是VS 2017。我对其进行了升级,现在所有内容都进行了编译。

Thanks to Roy Li for pointing out that the project templates have a minimum version of VS 2017. I upgraded it and now everything compiles.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文