项目属性不会打开-“没有可供选择的属性页" [英] Project Properties don't open - "There are no property pages for the selection"

查看:913
本文介绍了项目属性不会打开-“没有可供选择的属性页"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Visual Studio突然不会在多个解决方案文件中显示多个项目的项目属性.

Visual Studio suddenly won't display Project Properties for multiple projects, in multiple solution files.

我在解决方案资源管理器中的一个项目上单击鼠标右键,并显示一个错误框,显示为:There are no property pages for the selection.

I right-click on a project in the Solution Explorer, and get an error box reading: There are no property pages for the selection.

我认为问题不在于项目文件本身-我在从通用git信息库中提取的项目文件中看到了这一点,没有任何更改;这些项目昨天正常工作,并且继续为我在办公室的朋友提供了无障碍的服务.

I don't think the problem can be with the project files themselves - I'm seeing this on project files pulled from a common git repository, with no changes whatsoever; these projects worked correctly yesterday and continue to work with no trouble for my friends in the office.

我不知道已经以任何方式修改了Visual Studio设置.

I'm not aware of having modified Visual Studio settings in any way.

知道是什么原因造成的吗?

我正在Windows 7(SP1)上使用Microsoft Visual Studio Professional 2015,版本14.0.24720.00更新1,并且正在从事C ++项目.

I'm using Microsoft Visual Studio Professional 2015, Version 14.0.24720.00 Update 1, on Windows 7 (SP1), and I'm working on C++ projects.

推荐答案

我找到了问题的根源!问题出在我的VCTargetsPath系统环境变量中.

I've found the source of the problem! The problem lay in my VCTargetsPath system environment variable.

原来我的VCTargetsPath设置为:

C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140 

-似乎正确;那是正确的目录.

-- which seems correct; that's the right directory.

不幸的是,它缺少最后的反斜杠-必须为:

Unfortunately, it's missing the final backslash - it needs to be:

C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\

如果没有最后的反斜杠,它将不起作用.

Without that backslash at the end, it doesn't work.

显然,我遇到的问题是Visual Studio的各种实例,它们试图在此路径的顶部错误地焊接路径,例如我尝试构建一个android项目时遇到以下错误(请注意,以粗体显示):

Apparently the issues I was having were various instances of Visual Studio trying to weld paths incorrectly on top of this path, e.g. the following error I got trying to build an android project (note bold):

1> C:\ Program Files(x86)\ MSBuild \ Microsoft.Cpp \ v4.0 \ V140 \ Microsoft.Cpp.Clang.targets(210,5):错误MSB4062: 无法从程序集C:\ Program Files(x86)\ MSBuild \ Microsoft.Cpp \ v4.0 \ V140Microsoft.Build.CppTasks.Common.dll 加载"ClangCompile"任务. 无法加载文件或程序集'file:///C:\ Program Files(x86)\ MSBuild \ Microsoft.Cpp \ v4.0 \ V140Microsoft.Build.CppTasks.Common.dll 或以下之一它的依赖关系.系统找不到指定的文件.

1>C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.Cpp.Clang.targets(210,5): error MSB4062: The "ClangCompile" task could not be loaded from the assembly C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140Microsoft.Build.CppTasks.Common.dll. Could not load file or assembly 'file:///C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140Microsoft.Build.CppTasks.Common.dll or one of its dependencies. The system cannot find the file specified.

我已经修复了变量,并且确实解决了这个问题(以及我在第一个发现后发现的几个明显相关的问题.)

I've fixed the variable and it has, indeed, solved this issue (and several clearly related issues I discovered after the first one.)

如果其他用户遇到类似的问题,我强烈建议他们检查VCTargetsPath可能的错误,尤其是缺少的最后反斜杠.

If other users are experiencing similar issues, I strongly advise that they examine the VCTargetsPath for possible errors, and particularly for the missing final backslash.

为了帮助其他人解决同一问题,以下是我遇到的各种问题.所有这些仅与C ++项目有关,并且所有这些都由我描述的修复程序解决了.

In the interest of assisting others with the same issue, here are the various problems I was experiencing. All of these pertaining to C++ projects only, and all of them solved by the fix I described.

1.创建新项目时出错.如果我尝试在解决方案中创建新的C ++项目(例如,一个空的C ++项目),则会收到两条错误消息:

1. Errors when creating new project. If I try to create a new C++ project in a solution (e.g. an Empty C++ Project), I get two error messages:

  • 'null' is null or not an object
  • Exception from HRESULT: 0x800A138F
  • 'null' is null or not an object
  • Exception from HRESULT: 0x800A138F

然后创建了项目-尽管在屏幕底部的状态栏中,我看到一条消息,内容为:创建"Project1" ...项目创建失败.

The project is then created -- although in the status bar at the bottom of the screen, I see a message reading: Creating 'Project1' ... project creation failed.

2.无法将现有文件添加到项目中.如果尝试将现有源文件添加到项目中,则会收到两个连续的错误消息,内容为:

2. Cannot add existing file to project. If I attempt to add an existing source file to a project, I get two consecutive error messages reading:

  • The desired name for C:\tmp\foo.cpp is invalid.
  • The operation could not be completed. The parameter is incorrect. 该文件未添加到解决方案中.
  • The desired name for C:\tmp\foo.cpp is invalid.
  • The operation could not be completed. The parameter is incorrect. The file is not added to the solution.

3.无法访问项目属性或属性页..当我尝试访问项目的属性时,出现白色弹出窗口,标题为MyProject Property Pages(其中MyProject是项目名称),错误为:There are no property pages for the selection.

3. Cannot access Project Properties or Property Pages. When I try to access a project's properties, I get a white popup with the header MyProject Property Pages (where MyProject is the project name) and the error: There are no property pages for the selection.

如果我尝试查看属性页,则会收到相同的错误,除了项目名称以外,标题具有属性页的名称,例如Microsoft.Cpp.Win32.user Property Pages.

If I try to view property pages I get the same error, except instead of the project name, the header has the name of the property page, e.g. Microsoft.Cpp.Win32.user Property Pages.

4.当项目不是最新的时,Visual Studio无法识别. Visual Studio仍会构建我的C ++项目,并正确地构建它们.但是,一旦构建了一个项目,我就会遇到一个新问题:对源文件进行更改然后执行另一次构建无济于事-输出将项目列为最新,即使不是最新的.为了正确构建,我现在需要强制重建.

4. Visual Studio does not recognize when a project is not up-to-date. Visual Studio still builds my C++ projects, and builds them correctly. However, once I build a project, I have a new problem: making a change to a source file and then performing another build does nothing - the output lists the project as being up-to-date, even when it isn't. To build correctly, I now need to force a rebuild.

这篇关于项目属性不会打开-“没有可供选择的属性页"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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