简体   繁体   English

未为项目设置OutputPath属性(C ++,空白新解决方案,VS2017)

[英]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>
  1. 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> 
  2. Same as above, but add it in <ItemGroup Label="ProjectConfigurations"> 与上述相同,但将其添加到<ItemGroup Label="ProjectConfigurations">

  3. Remove Label="Configuration" . 删除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.). 根据另一个SO链接 ,我还尝试了AnyCPUAny CPU (在更复杂的解决方案中进行了测试,但是没有一个新的空解决方案。)

  5. 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> 
  6. Do above things, but in a property sheet. 做以上事情,但要在属性表中。

  7. 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问题都与msbuildC#.net另一个 )有关,而不与C ++有关

Reply 回复

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.

相关问题 UE4无法使用vs2017编译C ++项目 - UE4 can not compile c++ project with vs2017 当我打开C ++或MFC项目的Setup Property Pages时,如何使VS2017匹配配置和平台选择? - How to make VS2017 match configuration and platform selection when I open Setup Property Pages for a C++ or MFC project? VS2017 C ++ ifstream错误 - VS2017 c++ ifstream error VS2017在C ++中大括号缩进 - VS2017 indenting on braces in C++ VS2017加载手动配置为x86的C++项目作为VS2010项目 - VS2017 loads C++ project that was manually configured to x86 as a VS2010 project 多个错误,在VS2017的头文件中,opengl项目C ++ - Multiple errors, in header files in VS2017, opengl project C++ VS2017 是否允许在 C++ 项目的可视化对话框编辑器中更改控件的 Tab 键顺序? - Does VS2017 allow to change tab order of controls in a visual dialog editor for C++ project? 如何在项目目录的c++的VS2017中添加sqlite3.h、sqlite3.dll文件 - how to add sqlite3.h, sqlite3.dll files in VS2017 in c++ in project directory 无法在未安装 VS2017 的另一台机器上运行使用 VS2017 构建的 C++ 应用程序 - Not able to run C++ application built with VS2017 on another machine where VS2017 is not installed VS2017跨平台项目未设置C++17为语言标准 - VS2017 Cross platform project does not set C++17 as language standard
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM