2

It happens in a complex solution, but I can reproduce it in a new empty solution.

I built it (ctrl+shift+B) with debug mode, X86, diagnostic. enter image description here

1> Set Property: _InvalidConfigurationMessageText=The OutputPath property is not set for project 'ConsoleApplication1.vcxproj'. Please check to make sure that you have specified a valid combination of Configuration and Platform for this project. Configuration='Debug' Platform='Win32'. 1> Set Property: _InvalidConfigurationMessageText=The OutputPath property is not set for project 'ConsoleApplication1.vcxproj'. Please check to make sure that you have specified a valid combination of Configuration and Platform for this project. Configuration='Debug' Platform='Win32'. This error may also appear in some other project is trying to follow a project-to-project reference to this project, this project has been unloaded or is not included in the solution, and the referencing project does not build using the same or an equivalent Configuration or Platform.

enter image description here
^ I make sure that there isn't any References that it claims.

Here is what I have tried.

First, a part of my .vcxproj (link to the full file) looks like this:-

  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
    <ConfigurationType>Application</ConfigurationType>
    <UseDebugLibraries>true</UseDebugLibraries>
    <PlatformToolset>v141</PlatformToolset>
    <CharacterSet>Unicode</CharacterSet>
    ### I will insert something here ###
  </PropertyGroup>
  1. According to a SO link and another one, I should insert one of these lines at ### :-

    <OutputPath>$(Configuration)\$(Platform)\</OutputPath>
    <OutputPath>$(SolutionDir)$(Configuration)\</OutputPath>
    <OutputPath>bin\$(Platform)\</OutputPath>  
    
  2. Same as above, but add it in <ItemGroup Label="ProjectConfigurations">

  3. Remove Label="Configuration".

  4. According to another SO link, I also tried AnyCPU or Any CPU (tested in a more complex solution, but a new empty solution doesn't have it.).

  5. A Microsoft link states that Output Path is for C#. In C++, I must use Output Directory. It is OutDir.

    <OutDir>$(SolutionDir)$(Configuration)\</OutDir>
    <OutDir>$(Configuration)\$(Platform)\</OutDir>
    
  6. Do above things, but in a property sheet.

  7. Do above things, but also unloaded-reload project, and even restart VS2017.

After I tried every combination, the warning still exists.

The program can be compiled and run correctly,
but I believe it is a cause of unnecessary recompilation in a much larger solution.

Question: How to solve the warning/error?

OutputPath word in the console is suspicious.
I doubt VS recognize my solution as C#. (is it even possible? - my test project has std::cout)

For some reasons, most SO questions about this error are related to msbuild or C# or .net (another one), not C++.

Reply

There is no such Win32 option in the combo box, so I create a new one.
Configuration Manager > Active solution platform : <New...>

I also make sure that the setting is correct :- enter image description here

However, I still got the same error message.

cppBeginner
  • 1,114
  • 9
  • 27
  • That it is missing from the .vcxproj file is not unusual, it relies on the default. The default value is determined by the toolset, on my machine it is located in C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\VC\VCTargets\Platforms\Win32\PlatformToolsets\v141\Toolset.props – Hans Passant Dec 21 '17 at 13:10
  • @Hans Passant : I found 2 files in `...\Common7\IDE\VC\VCTargets\Platforms\Win32\PlatformToolsets\v141`. They are `Toolset.props` and `Toolset.targets`. My test `.vcxproj` contains `v141` (consistent). I am not sure what I can do about it. – cppBeginner Dec 21 '17 at 13:40
  • Strange, a few year later, I don't have the problem anymore. It might be related to project re-targeting & recreating every configuration from scratch. – cppBeginner Sep 10 '19 at 05:02

2 Answers2

0

You have suspicious platform set - x86, change it to Win32.

UPD.: so the problem appears to be not with the project, but with Visual Studio installation - try to repair/reinstall it.

Anton Malyshev
  • 8,686
  • 2
  • 27
  • 45
  • I just tried. I still got the same error (I add it into the question). Nice guess though. Thank. – cppBeginner Dec 21 '17 at 12:19
  • So it seems that project properties just messed out. Can you just create a new project and add your source code into it? – Anton Malyshev Dec 21 '17 at 12:21
  • I tried it before. It can compile (with the warning) and run fine. After you suggested, I have just created the 2nd project `Window Console Application` on the same test solution. It also compiles fine (with the warning) and run fine. The new warning/error is `OutputPath property is not set for project 'ConsoleApplication2.vcxproj'` ... same as before. – cppBeginner Dec 21 '17 at 12:24
  • I don't think the project property (`.vcxproj`) is messed out, because it is created by the VS's wizard. Just in case, I also attached the file to the question. – cppBeginner Dec 21 '17 at 12:30
  • Yes, it rather seems that's something wrong with your Visual Studio installation. Like environment variables are missing or something like that... – Anton Malyshev Dec 21 '17 at 12:37
  • I agreed, so I tried it. However, after I repair it (good bye my settings) and create a new solution, the same warning still appear... strange. – cppBeginner Dec 21 '17 at 13:35
0

On my case, we moved the project from a different system, so, some of the directories were pointing to a wrong (non default) path.
On Solution Explorer, right click the project name, select Unload the project, then, right click again and select Edit the xxx.csproj, finally search, check and fix your <OutputPath>bin\Debug\</OutputPath> or <OutputPath>bin\Release\</OutputPath>on your different PropertyGroup conditions.

fcm
  • 1,247
  • 15
  • 28