wpf Surface SDK 可以在 Visual Studio 2012 上运行吗?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/14225303/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-13 06:57:42  来源:igfitidea点击:

Can Surface SDK run on Visual Studio 2012?

wpfvisual-studio-2010visual-studio-2012pixelsense

提问by scojomodena

I need to create a WPF app using the Surface SDK. I am using Visual Studio 2012, and according to thisSO post, VS2012 doesn't allow that. However, since this was posted before it was officially released, I want to make sure I'm not missing something.

我需要使用 Surface SDK 创建一个 WPF 应用程序。我正在使用 Visual Studio 2012,根据这篇SO 帖子,VS2012 不允许这样做。然而,由于这是在正式发布之前发布的,我想确保我没有遗漏任何东西。

I just need a few of the touch/swipe controls that come with it. Is there a different option for VS2012? The other developer is using 2010, so it needs to be able to still run on his machine. It's a very simple app that I just need to hammer out, so I'm looking for the fastest, easiest method. Both of us and the end application is to run on Windows 7.

我只需要一些随附的触摸/滑动控件。VS2012 有不同的选择吗?另一个开发人员使用的是 2010,所以它需要能够仍然在他的机器上运行。这是一个非常简单的应用程序,我只需要敲定,所以我正在寻找最快、最简单的方法。我们和最终应用程序都将在 Windows 7 上运行。

采纳答案by Steven Jeuris

I found an easy solution by which it seems to work. It does expect you to have Visual Studio 2010 installed. Following the following steps I managed to compile in Visual Studio 2012 using .NET 4.5. TouchDownevents work. I tried it out on some small projects and they seem to work perfectly fine.

我找到了一个似乎可行的简单解决方案。它确实希望您安装 Visual Studio 2010。按照以下步骤,我设法使用 .NET 4.5 在 Visual Studio 2012 中进行编译。TouchDown事件工作。我在一些小项目上尝试过,它们似乎工作得很好。

  1. Use Visual Studio 2010 to set up a Surface project.
  2. Safe and close Visual Studio 2010.
  3. Open the solution using Visual Studio 2012.
  4. Change the target framework under project settings to .NET 4.5.
  5. Save as a new solution file.
  6. Compile, ... everything works!
  1. 使用 Visual Studio 2010 设置 Surface 项目。
  2. 安全并关闭 Visual Studio 2010。
  3. 使用 Visual Studio 2012 打开解决方案。
  4. 将项目设置下的目标框架更改为 .NET 4.5。
  5. 另存为新的解决方案文件。
  6. 编译,...一切正常!

This method prevents you from having to set up all the configuration files/references yourself. The only downside is you don't have any of the Surface tools integrated into the IDE. E.g. the toolbox, project templates, ... This of course doesn't prevent you from writing plain XAML yourself.

这种方法使您不必自己设置所有配置文件/引用。唯一的缺点是您没有将任何 Surface 工具集成到 IDE 中。例如,工具箱、项目模板……这当然不会阻止您自己编写普通的 XAML。

If for some reason this doesn't work in the long run I will update this post.

如果由于某种原因这从长远来看不起作用,我会更新这篇文章。

回答by Michal Strzalkowski

The easiest way will unfortunately be for you to run VS2010.

不幸的是,最简单的方法是运行 VS2010。

Currently the SDK is not supported in VS2012, for a few reasons. Notably, the way that touch works in Win8 is a lot better than in previous versions of Windows. This unfortunately meant a rewrite of the touch layer that the Surface SDK uses. The new controls are written to adapt dynamically based on mouse/touch input, making the Surface SDK controls a bit redundant.

目前 VS2012 不支持 SDK,原因有几个。值得注意的是,触控在 Win8 中的工作方式比以前版本的 Windows 好很多。不幸的是,这意味着重写 Surface SDK 使用的触摸层。新控件被编写为基于鼠标/触摸输入动态适应,使得 Surface SDK 控件有点多余。

Microsoft might make the SDK available for VS2012 in the future, but this is kind of debatable.

微软可能会在未来为 VS2012 提供 SDK,但这有点值得商榷。

If you are still dead set on giving it a shot, download an application called Orca (http://msdn.microsoft.com/en-us/library/windows/desktop/aa370557(v=vs.85).aspx) and edit the SDK installer file, removing the dependency on VS2010.

如果您仍然想试一试,请下载一个名为 Orca 的应用程序 (http://msdn.microsoft.com/en-us/library/windows/desktop/aa370557(v=vs.85).aspx) 和编辑SDK安装文件,去掉对VS2010的依赖。

This is how I got the Surface 1 SDK to work with VS2010, since it was targeting VS2008 (note that it still has not been updated to work with VS2010)

这就是我让 Surface 1 SDK 与 VS2010 一起使用的方式,因为它针对的是 VS2008(请注意,它还没有更新为与 VS2010 一起使用)

Let me know how you go.

让我知道你怎么去。