如何修复 VisualStudio 2019 中对 Windows.Foundation.UniversalApiContract 的引用

发布于 2025-01-13 04:30:36 字数 462 浏览 2 评论 0原文

我使用 VisualStudio 2019 创建了包含多个 .Net 和 UWP 项目的解决方案,其中一些项目创建时 VisualStudio 添加了对 Windows.Foundation.UniversalApiContract 的引用。由于我使用例如 Windows.Storage.Stream 我无法删除此引用。

当我使用我创建解决方案的目录中的解决方案时,没有问题。但是当我将其签入我的电脑上的另一个目录时,这个引用就不再满足了。我的同事也无法研究这个解决方案。

谁能告诉我如何解决这个问题?我是否错过了一些需要办理登机手续的事情?我使用 github 中的 VisualStudio 默认 .gitignore。

亲切的问候, 沃尔夫冈

I created a solution with several .Net and UWP projects with VisualStudio 2019 and on some of them a reference to Windows.Foundation.UniversalApiContract was added by VisualStudio on project creation. Since I use for instance Windows.Storage.Stream I can not remove this references.

When I use the solution in the directory I created the solution, it is no problem. But when I check it out into another directory on my PC, this reference could no longer be satisfied. My working collegue can also not work on this solution.

Can anyone tell my how I can fix this problem? Did I missed something to check in? I am using the default .gitignore for VisualStudio from github.

Kind regards,
Wolfgang

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

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

发布评论

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

评论(1

昇り龍 2025-01-20 04:30:36

我通过将项目文件中引用的 HintPath 从相对路径转换为绝对路径来解决该问题,这在大多数 PC 上应该是相同的

C:\Program Files (x86)\Windows Kits\10\References\10.0.19041.0\Windows.Foundation.UniversalApiContract\10.0.0.0\Windows.Foundation.UniversalApiContract.winmd

并且比它更可靠

..\..\..\..\..\..\..\Program Files (x86)\Windows Kits\10\References\10.0.19041.0\Windows.Foundation.UniversalApiContract\10.0.0.0 \Windows.Foundation.UniversalApiContract.winmd

因为此路径不依赖于解决方案目录的位置。

I fixed the problem by converting HintPath of the reference in project file from relative path to an absolute path, which should be equal on most PCs

C:\Program Files (x86)\Windows Kits\10\References\10.0.19041.0\Windows.Foundation.UniversalApiContract\10.0.0.0\Windows.Foundation.UniversalApiContract.winmd

and is more reliable than

..\..\..\..\..\..\..\Program Files (x86)\Windows Kits\10\References\10.0.19041.0\Windows.Foundation.UniversalApiContract\10.0.0.0\Windows.Foundation.UniversalApiContract.winmd

because this path depends not on location of solution directory.

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