Julien BERNARD
Julien BERNARD

Reputation: 701

Can Visual Studio be configured to make Header Files public by default?

I often make C++ Google Test projects inside Visual Studio that test another project via Project References.

For the test project to find the tested project's methods, I need to configure something in the "Public Project Content" of the tested project.

Public Project Content

By default nothing is public. With every new project I need to edit the properties. So I was wondering, is there a way to make "Yes" the default for "All Header Files are Public", for instance ?

Thanks.

Upvotes: 0

Views: 234

Answers (1)

Casey
Casey

Reputation: 10936

Use a custom Property Sheet that can be added to a project.

  1. View > Property Manager > Add new Property Sheet (the wrench/spanner with the star).
  2. Name it and save it somewhere. (I'd recommend "Google.Test.Default.props" the quotes are required)
  3. Open the sheet by double-clicking on it in the list.
  4. Change only the properties relevant to default Google Test settings.
  5. Apply/OK

The list is ordered where higher entries supersede lower entries and the top-most "project" properties contains all changes and can be modified on a per-project basis.

Then, for every subsequent project:

  1. View > Property Manager > Add existing property sheet
  2. Navigate to the previously saved Google.Test.Default.props file.
  3. Reorder in the list as needed.
  4. Done.

If you've changed any settings in the top-most project settings you'll have to go through them and change the relevant settings to <Inherit from parent or project defaults> to have the project use the new property sheet.

Upvotes: 1

Related Questions