11

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.

Ziv
  • 2,369
  • 3
  • 24
  • 40
  • You'll have to spin the repair/reinstall wheel of fortune. But thoroughly checking the disk drive first would be wise, this is not healthy of course. – Hans Passant Apr 11 '16 at 13:39
  • @HansPassant: Thanks! What do you mean about "thoroughly checking the disk drive"? Do you mean a data problem in the project files, or a potential hardware issue? (I'm not seeing how either of those seem likely?) – Ziv Apr 11 '16 at 14:02
  • 2
    This mishap is too unspecific and unusual to give you specific advice where to look. I could guess but that will just distract from what you *really* should do. Which is checking if your disk drive is still in good shape. If you don't know how to do that then look at superuser.com – Hans Passant Apr 11 '16 at 14:10
  • @HansPassant Thank you! – Ziv Apr 11 '16 at 14:26

7 Answers7

21

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.

Ziv
  • 2,369
  • 3
  • 24
  • 40
  • Please check your Registry unter `HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSBuild\ToolsVersions` and verify if there're entries of `VCTargetsPathXX`. I have several and all prefer the corresponding Environment Variable over a default value. And indeed, the default has a trailing Backslash. So, removing your System Environment Variable `VCTargetsPath` could have the exact same effect. – Hurix Aug 28 '17 at 18:00
0

If you have VS2017 installed

From PowerShell :

[Environment]::SetEnvironmentVariable("VCTargetsPath", "C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\Common7\IDE\VC\VCTargets\", "Machine")
Ebram
  • 1,042
  • 1
  • 13
  • 26
0

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.

0

Make sure the it's the solution file that's been opened (close Visual Studio, double click on the .sln file to open it in Visual Studio).

Graham Laight
  • 4,700
  • 3
  • 29
  • 28
0

NOTHING ABOVE helped me, but removing VCTargetsPath variable at all, did trick. Tested on vs2019 and 2019 preview 2

Oleksandr
  • 11
  • 1
0

I was working with VS2019 when the problem "NULL is null" occurred with a few of the C++ projects that I've been working with for years. The solution that worked for me was to exit from VS2019, delete the folder/directory .VS (i.e. in the same directory as my VS2019 solution .SLN file) and then to restart VS2019.

Ian
  • 53
  • 1
  • 10
-1

Just close the design tap and re-open it. It works for me.