-2

The question is how can I setup a group of source files using matching settings, and specific settings for files that need special treatment?

My question came about because of a build issue which I have now figured out

Peter Nimmo
  • 1,045
  • 2
  • 12
  • 25
  • 2
    This is not how you do a self answer Q&A. Your question needs to contain an actual question that anyone can answer. As is there is no question in your question body. – NathanOliver Jul 13 '16 at 11:46
  • I'm not sure how re-stating the question again in the body adds any information. I have re-titled it with a more specific question, – Peter Nimmo Jul 13 '16 at 12:11
  • It is just how the site works. It is a Q&A site, following a very strict model. The "question" part has to ask a question, the "answer" part has to contain the answer. It doesn't matter if you are self-answering, you still need to follow the same model as you would for any other question. This is not a blog, or a message board, or something like that where you can just free-form. – Cody Gray - on strike Jul 14 '16 at 06:32

1 Answers1

-1

The following is roughly how that project system seems to work.

Please correct any misconceptions.

1. There are three types of settings

  • i) Property Page Settings (these can be inherited)
  • ii) Project Settings
  • iii) File Settings

    Project settings affect all source files that do not have a file setting

    Project settings are specific to a configuration

    When examining a file setting (a file node rather than a project node is selected) items showing in Bold are settings set at file level
    If the setting is not bold then it is a File Setting

    Within the project settings (the project node is selected) any items showing as bold are project settings, any showing as not bold are inherited from a property sheet

2. Any file that doesn't have a file level setting uses the project settings

3. To set a project setting make sure to click the project node

4. To set a file setting click on the file that you want the setting to affect

5. If the tool type you need to modify is not showing as available under project settings, briefly select a file for which that tool is valid and then re-click the project node

A good example of doing this is when you want to use pre-compiled headers. In this instance the majority of files need to consume the pre-compiled header and so you would set Use \Yu under C/C++->Precompiled Headers:Precompiled Header

Then under stdafx.cpp you would make it a file level setting (clicking on stdafx.cpp) and select Create \Yc under C/C++->Precompiled Headers:Precompiled Header

Your project might also contain .C files that have been generated by Midl, and so for those files you would at file level select Not Using Precompiled Headers under C/C++->Precompiled Headers:Precompiled Header

I am now trying to get to the root of what is causing MSBuild Error MSB8028 in one of my projects.

However the test project I created to research the problem does not seem to be obeying the rules I set out above. Each of the .cpp files in the project are ignoring the project setting for Precompiled Headers, but they are showing as non-bold

The above statement is false, but it has led me to the golden rule!

Make sure 'Configuration' contains the word 'Active'

Of course you can ignore this rule, but make sure to keep it in your mind to avoid the possibility that you have not created a setting within the wrong configuration, which will explain why the behaviour you were expecting is not actually what you are getting

Peter Nimmo
  • 1,045
  • 2
  • 12
  • 25