如何在非 UWP C# 项目中访问 Windows.Gaming.Input? [英] How Do I Access Windows.Gaming.Input in a Non-UWP C# Project?

查看:21
本文介绍了如何在非 UWP C# 项目中访问 Windows.Gaming.Input?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经看到一些在 C++ 控制台应用程序中使用 Windows.Gaming.Input 的示例,但是否也可以在非 UWP C# 项目中访问它?

I've seen some examples of using Windows.Gaming.Input in C++ console apps but is there a way to access it in a non-UWP C# project as well?

谢谢,

推荐答案

我通过执行以下操作成功做到了这一点:

I've managed to do this by doing the following:

  1. 确保 VisualStudio 没有运行.
  2. 在文本编辑器中打开您的项目 *.csproj 文件,例如记事本.
  3. 10.0 添加到 *.csproj 文件.您可以将其放在 条目之后.
  4. 在 Visual Studio 中打开您的项目.
  5. 使用 nuget 添加 System.Runtime.WindowsRuntime 参考(我使用的是当时最新的稳定版本 v4.7.0),或手动浏览系统上的 DLL 文件.
  6. 在解决方案/项目资源管理器中,右键单击引用 ->添加引用...
  7. 您应该能够看到Universal Windows"现在作为一种选择.
  8. 添加 Windows.Gaming 引用.
  9. 在您的 *.cs 文件中,您将希望使用带有 using Windows.Gaming.Input; 的参考.如果未找到引用,请尝试将其包含在命名空间之外.
  1. Make sure VisualStudio is not running.
  2. Open your project *.csproj file in a text editor, e.g. notepad.
  3. Add <TargetPlatformVersion>10.0</TargetPlatformVersion> to the *.csproj file. You can put it after the <TargetFrameworkVersion/> entry.
  4. Open you project in Visual Studio.
  5. Add the System.Runtime.WindowsRuntime reference (I used v4.7.0, newest stable version at the time) with nuget, or manually browse for the DLL file on your system.
  6. In Solution/Project Explorer, right-click References -> Add Reference...
  7. You should be able to see "Universal Windows" on the side as an option now.
  8. Add the Windows.Gaming reference.
  9. In your *.cs files, you'll want to use the reference with using Windows.Gaming.Input;. If the reference is not found, try including it outside the namespace.

这篇关于如何在非 UWP C# 项目中访问 Windows.Gaming.Input?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆