Project Properties don't open - “There are no

2020-03-02 16:28发布

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

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

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.

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

Any idea what might be causing this?

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.

3条回答
我只想做你的唯一
2楼-- · 2020-03-02 17:08

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

It turns out my VCTargetsPath was set to:

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.

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): 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.)

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.


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. 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

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. 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 file is not added to the solution.

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.

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 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.

查看更多
做个烂人
3楼-- · 2020-03-02 17:12

If you have VS2017 installed

From PowerShell :

[Environment]::SetEnvironmentVariable("VCTargetsPath", "C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\VC\VCTargets\", "Machine")
查看更多
爷、活的狠高调
4楼-- · 2020-03-02 17:12

Same symptoms, different cause: For me this problem appeared when I tried to set the platform toolset to VS2010/v100 for a project in VS2015. The project properties where no longer accessible and gave the "There are no property pages [...]" error.

The cause was that VS2010 was installed as german version, while VS2015 was set to english. Changing VS2015 to german fixed the problem, changing both to english fixes the problem. Interestingly VS2010 in english, but VS2015 set to german, also works.

查看更多
登录 后发表回答