简体   繁体   English

VS2012 将“Windows 应用商店应用支持”设置为 true 时出现的“项目不兼容”消息

[英]VS2012 "Project is incompatible" message from setting "Windows Store App Support" to true

So I have two problems.所以我有两个问题。 The first is that there is some code that has a lot of using statements for things in the Windows namespace like this:首先是有些代码对Windows命名空间中的事物有很多using语句,如下所示:

using namespace Windows::System;
using namespace Windows::Storage;
using namespace Windows::ApplicationModel;

For some reason this is causing a ton of compiler errors like this:出于某种原因,这导致了大量的编译器错误,如下所示:

error C2039: 'System' : is not a member of 'Windows'
error C2871: 'System' : a namespace with this name does not exist
error C2039: 'Storage' : is not a member of 'Windows'
error C2871: 'Storage' : a namespace with this name does not exist
error C2039: 'ApplicationModel' : is not a member of 'Windows'
error C2871: 'ApplicationModel' : a namespace with this name does not exist
error C3083: 'ApplicationModel': the symbol to the left of a '::' must be a type

I found a fix for this problem by setting the "Windows Store App Support" property of the project to true.我通过将项目的“Windows Store App Support”属性设置为 true 找到了解决此问题的方法。 This is really strange that I need to do this since it's not a windows store application, but it's the only thing I've found to fix the compiler errors.这真的很奇怪,我需要这样做,因为它不是 Windows 商店应用程序,但它是我发现修复编译器错误的唯一方法。

The second problem is that when I restart visual studio it fails to load the project with the error message: "Project is incompatible with the current edition of Visual Studio".第二个问题是,当我重新启动 Visual Studio 时,它无法加载项目并显示错误消息:“项目与当前版本的 Visual Studio 不兼容”。 I'm not sure if this is a bug in Visual Studio 2012 or what, but it seems very odd to me that it lets you set this option if it's going to make the project incompatible the next time you open it.我不确定这是 Visual Studio 2012 中的错误还是什么,但对我来说似乎很奇怪,它允许您设置此选项,如果它会使您下次打开项目时不兼容。

If there's an alternative solution to fixing the compiler errors that doesn't involve turning on the store app property then that would be the preferred solution, but I'm up for anything at this point.如果有一个替代解决方案来修复编译器错误而不涉及打开商店应用程序属性,那么这将是首选解决方案,但我现在愿意做任何事情。

Figured it out.弄清楚了。 This website has all the information needed on what paths you need to add in order to get it to find the windows.winmd file, which is what spawned all of my original issues. 该网站包含有关您需要添加哪些路径才能找到 windows.winmd 文件所需的所有信息,这就是我所有原始问题的产生原因。 Once I followed their steps it fixed all my issues.一旦我按照他们的步骤,它就解决了我所有的问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM