Visual Studio: Which configuration is used for complile when using Ctrl-F7? - Stack Overflow

I asked this question in the VS Development Community a couple of years ago, but never got an answer -

I asked this question in the VS Development Community a couple of years ago, but never got an answer - and MS closed it because they didn't understand the question.

I frequently use ctrl-F7 in VS2017 to compile the C++ file currently active in the editor for a quick check after making updates.

However, I can’t figure out which build configuration will be compiled in that case. It’s not (always) the selected startup project; it just seems to be random.

Before SharedItems projects, my recollection (hazy) it the compile was for the project from where you opened the file in Solution Explorer. But that doesn’t make sense if the C++ file is in a SharedItems project.

Does anyone know which build configuration the VS IDE decides which configuration to compile the C++ file when we use ctrl-F7? And is there any way we can control that?

I asked this question in the VS Development Community a couple of years ago, but never got an answer - and MS closed it because they didn't understand the question.

I frequently use ctrl-F7 in VS2017 to compile the C++ file currently active in the editor for a quick check after making updates.

However, I can’t figure out which build configuration will be compiled in that case. It’s not (always) the selected startup project; it just seems to be random.

Before SharedItems projects, my recollection (hazy) it the compile was for the project from where you opened the file in Solution Explorer. But that doesn’t make sense if the C++ file is in a SharedItems project.

Does anyone know which build configuration the VS IDE decides which configuration to compile the C++ file when we use ctrl-F7? And is there any way we can control that?

Share Improve this question asked Mar 24 at 20:24 GlobalEngineerGlobalEngineer 1
Add a comment  | 

1 Answer 1

Reset to default 0

Question is a bit unclear, about platform / configuration, but also about file / project.

I've searched a bit for an official source. According to [MS.Learn]: Build and clean projects and solutions in Visual Studio (emphasis is mine)

In Solution Explorer, choose multiple files that can be compiled, open the shortcut menu for one of those files, and then choose Compile, or press Ctrl+F7.

If the files have dependencies, the files will be compiled in dependency order. The compile operation will fail if the files require a precompiled header that isn't available when you compile. The compile operation uses the current active solution configuration.

I prepared an example to illustrate the behavior:

In the VStudio 2017 window above, platform and configuration (x64, Release) are highlighted in red, while current file file and the project it belongs to (dll00.c, dll00) in green. When compiling current file (Ctrl + F7) the information is also displayed in the Output window (at the bottom, highlighted in thinner lines).

But there is a catch: the solution and project(s) platform / configuration tuples must be properly configured (and mapped):

In the above solution properties window, I selected All Platforms / All Configurations just to present all 8 configurations (2 projects / 2 platforms / 2 configurations), but one must be sure that for a specific solution platform / configuration tuple, the corresponding projects tuples are selected.
Check [MS.Learn]: Understand build configurations for more details.

Might be (more or less) related:

  • [SO]: Excel VBA, Can't Find DLL Entry Point from a DLL file (@CristiFati's answer)

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744229752a4564189.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信