Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Project Properties don't open - "There are no property pages for the selection"

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.

like image 766
Ziv Avatar asked Apr 11 '16 12:04

Ziv


People also ask

How do I open project properties?

You access project properties by right-clicking the project node in Solution Explorer and choosing Properties, or by typing properties into the search box on the menu bar and choosing Properties Window from the results.

How do I open a project property page in Visual Studio?

To open the Property Pages, choose Project > Properties from the main menu, or right-click on the project node in Solution Explorer and choose Properties. Individual files also have property pages that enable you to set compile and build options for just that file.

How do I enable properties in Visual Studio?

You can find Properties Window on the View menu. You can also open it by pressing F4 or by typing Properties in the search box. The Properties window displays different types of editing fields, depending on the needs of a particular property.

How do I download Visual C++ build tools?

In a web browser window, go to https://visualstudio.microsoft.com/downloads/: 2. Scroll down and open the Tools for Visual Studio 2019 section. 3. Find Build Tools for Visual Studio 2019 and click Download.


1 Answers

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.

like image 188
Ziv Avatar answered Sep 22 '22 12:09

Ziv