[英]The OutputPath property is not set for project (C++, blank new solution, VS2017)
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. 我用调试模式X86,诊断程序构建了它( ctrl+shift+B
)。
1> Set Property: _InvalidConfigurationMessageText= The OutputPath property is not set for project 'ConsoleApplication1.vcxproj'. 1>设置属性:_InvalidConfigurationMessageText = 未为项目 'ConsoleApplication1.vcxproj' 设置OutputPath属性 。 Please check to make sure that you have specified a valid combination of Configuration and Platform for this project. 请检查以确保为该项目指定了配置和平台的有效组合。 Configuration='Debug' Platform='Win32'. 配置=“调试”平台=“ Win32”。 1> Set Property: _InvalidConfigurationMessageText=The OutputPath property is not set for project 'ConsoleApplication1.vcxproj'. 1>设置属性:_InvalidConfigurationMessageText =未为项目'ConsoleApplication1.vcxproj'设置OutputPath属性。 Please check to make sure that you have specified a valid combination of Configuration and Platform for this project. 请检查以确保为该项目指定了配置和平台的有效组合。 Configuration='Debug' Platform='Win32'. 配置=“调试”平台=“ 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. 该错误也可能出现在其他项目中,该项目正在尝试对该项目进行项目间引用 ,此项目已被卸载或未包含在解决方案中,并且引用项目未使用相同或等效项进行构建配置或平台。
^ I make sure that there isn't any References
that it claims. ^我确保没有它声称的任何References
。
Here is what I have tried. 这是我尝试过的。
First, a part of my .vcxproj
( link to the full file ) looks like this:- 首先,我的.vcxproj
( 指向完整文件的链接 )的一部分看起来像这样:
<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>
According to a SO link and another one , I should insert one of these lines at ###
:- 根据一个SO链接和另一个 链接 ,我应该在###
处插入以下行之一:-
<OutputPath>$(Configuration)\\$(Platform)\\</OutputPath> <OutputPath>$(SolutionDir)$(Configuration)\\</OutputPath> <OutputPath>bin\\$(Platform)\\</OutputPath>
Same as above, but add it in <ItemGroup Label="ProjectConfigurations">
与上述相同,但将其添加到<ItemGroup Label="ProjectConfigurations">
Remove Label="Configuration"
. 删除Label="Configuration"
。
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.). 根据另一个SO链接 ,我还尝试了AnyCPU
或Any CPU
(在更复杂的解决方案中进行了测试,但是没有一个新的空解决方案。)
A Microsoft link states that Output Path
is for C#
. Microsoft链接指出“ Output Path
用于C#
。 In C++
, I must use Output Directory
. 在C++
,我必须使用Output Directory
。 It is OutDir
. 是OutDir
。
<OutDir>$(SolutionDir)$(Configuration)\\</OutDir> <OutDir>$(Configuration)\\$(Platform)\\</OutDir>
Do above things, but in a property sheet. 做以上事情,但要在属性表中。
Do above things, but also unloaded-reload project, and even restart VS2017. 做以上事情,还要卸载-重载项目,甚至重启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. 控制台中的OutputPath
单词可疑。
I doubt VS recognize my solution as C#
. 我怀疑VS是否将我的解决方案识别为C#
。 (is it even possible? - my test project has std::cout
) (甚至可能吗?-我的测试项目具有std::cout
)
For some reasons, most SO questions about this error are related to msbuild or C# or .net ( another one ), not C++ . 由于某些原因,有关此错误的大多数SO问题都与msbuild或C#或.net ( 另一个 )有关,而不与C ++有关 。
There is no such Win32
option in the combo box, so I create a new one. 组合框中没有这样的Win32
选项,因此我创建了一个新选项。
Configuration Manager
> Active solution platform
: <New...>
Configuration Manager
> Active solution platform
: <New...>
I also make sure that the setting is correct :- 我还要确保设置正确:-
However, I still got the same error message. 但是,我仍然收到相同的错误消息。
You have suspicious platform set - x86, change it to Win32. 您有可疑的平台集-x86,将其更改为Win32。
UPD.: so the problem appears to be not with the project, but with Visual Studio installation - try to repair/reinstall it. UPD 。:因此问题似乎不在于项目,而在于Visual Studio安装-尝试修复/重新安装它。
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. 在Solution Explorer
,右键单击项目名称,选择“ Unload the project
,然后再次右键单击并选择“ Edit the xxx.csproj
,最后搜索,检查并修复您的<OutputPath>bin\\Debug\\</OutputPath>
或<OutputPath>bin\\Release\\</OutputPath>
在不同的PropertyGroup条件下。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.