User-Wide Settings in Visual Studio 2015

Back in my post on Creating wxWidgets programs with Visual Studio – Part 1, I included instructions for setting a system environment variable for the wxWidgets directory, and instructions for adding Include and Library directories for projects in Visual Studio. These latter instructions must be repeated for every project that uses wxWidgets. Thanks to a suggestion from legalize (see his comment on the post linked above), I will provide instructions to define a user macro from within Visual Studio 2015 that provides this variable on a per-user basis. I will also provide instructions for setting up the Include and Library directories across all projects and solutions on a per-user basis.

We will be creating user-wide settings for Visual Studio. Illogically, Microsoft has hidden the interface for these settings in the property manager for a single project. To begin, start Visual Studio 2015 and load a solution, or create a new one. Now select the View->Property Manager menu item. This opens the Property Manger tab as shown in this image for the HelloWorld sample program.


When you first display the Property Manager tab,  only HelloWorld will be visible. Click on the expander for HelloWorld to show the list of configurations, then expand one of the configurations that you will be building. In the image above, I have opened the Debug | x64 configuration. Note that if your solution contains more than one project, then each project will be listed. It is only necessary to open one of the project expanders. Note that the first item under Debug | x64 is Microsoft.Cpp.x64.user. For the Win32-related configurations, the first item is Microsoft.Cpp.Win32.user. Double-click on this item to open the Microsoft.Cpp.x64.user Property Pages or the Microsoft.Cpp.Win32.user Property Pages:


Click on the User Macros item to display the image above. Now click on the Add Macro button to open the Add User Macro dialog. Fill in the name of the macro (WXWIN for wxWidgets), the macro value (C:\wxWidgets on my computer), and check the checkbox. The dialog will look like this:


Click the OK button to close the dialog. The property pages dialog now looks like this:


As you can see, the macro has been added. Add any other macros that you need.

Click on VC++ Directories, and click on Include Directories. See the image below.


Click on the down arrow box at the end of the Include Directories line and select <Edit…> to open the Include Directories dialog.

Double-click in the empty scroll box at the top of the dialog and enter $(WXWIN)\include. Double-click below this line and enter $(WXWIN)\include\msvc. Press Enter, and the dialog box will look like this:


Click the OK button to close the Include Directories Dialog, and then the Apply button. Now select Library Directories and open the Library Directories dialog. Enter the path to the wxWidgets library files (e.g.$(WXWIN)/lib/vc_x64_dll if you created the wxWidgets x64 DLL configuration). Click the OK button to close the Library Directories dialog, and then the Apply and OK buttons on the Properties Pages dialog.

If you now expand the Release | x64 configuration and open the Microsoft.Cpp.x64.user Property Pages dialog, you will see that the user macro and the VC++ Directories are listed here as well. If you also build Win32 configurations, you will have to repeat all of this procedure for Microsoft.Cpp.Win32.user. The properties that you set are saved in the %LOCALAPPDATA%\Microsoft\MSBuild\v4.0\Microsoft.Cpp.x64.user.props file for x64 configurations, and %LOCALAPPDATA%\Microsoft\MSBuild\v4.0\Microsoft.Cpp.Win32.user.props for Win32 configurations.

The next time you open a different solution or create a new solution, these properties will be included.


5 thoughts on “User-Wide Settings in Visual Studio 2015

  1. Pingback: Creating wxWidgets Programs with Visual Studio 2015 – Part 1 | Using C++

  2. Pingback: Improving Visual Studio Solution Build Times – Multiple Processors | Using C++

  3. Pingback: Moving The Circle Off Centre | Using C++

  4. Pingback: Google Test and Visual Studio | Using C++

  5. Pingback: Creating wxWidgets Programs with Visual Studio 2017 – Part 1 | Using C++

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s