Microsoft Visual C++ NuGet
|This article applies to the following versions|
|Any||2010 Any Edition|
|Any||2012 Any Edition|
|Any||2013 Any Edition|
This guide assumes you had already obtained the source code to wxWidgets. This guide can be completed in 3 easy steps.
This package does not include any template code. It is simply a helper for linking the project to wxWidgets, saving developers from spending time manually editing the project property pages. A more apt name for the package would be wxWidgetsHelper since the package does not check out or redistribute the wxWidgets library.
1. Install the NuGet Package Manager via the Visual Studio Extension Manager
The package manager may already be installed depending on your version/edition of Visual Studio. It can be installed from within Visual Studio, by searching for "NuGet" within Visual Studio's Extension Manager (Tools->Extensions and Updates...). Detailed instructions can be found here.
2. Install the wxWidgetsTemplate NuGet Package via the NuGet Package Manager
This step is is also done from within Visual Studio, and can be done in one of two ways:
- Either: Search for and install the wxWidgetsTemplate from within the Manage NuGet Packages pane (Tools->Library Package Manager->Manage NuGet Packages for Solution...):
- Or: Enter the command Install-Package wxWidgetsTemplate within the Package Manager Console (If hidden, select View->Other Windows->Package Manager Console):
There are many other C++ libraries available via NuGet (most NuGet packages are portable .NET libraries). To find the C++ ones search for the Native tag.
If you use Source Code Management, commit <SolutionDir>/.nuget/packages.config, <SolutionDir>/packages/repositories.config, and <ProjectDir>/packages.config. These contain the links to the NuGet packages; do not version the packages themselves. Other developers opening the project will be notified of the missing dependencies, the dependencies will be downloaded after they press the "Update" button on the prompt. See for more information. If the packages are updated, NuGet will pop up notifications that updates are available.
3. Customize the target wxWidgets library options
Open your project's properties (for any project that links to wxWidgets libraries). The options may either appear in Common Properties or Configuration Properties depending on your version of Visual Studio. Here is a brief description of each of the options:
- wxWidgets path should point to your working copy of the wxWidgets library. This field will be populated with $(WXWIN) if you had defined it.
- SHARED determines if your project dynamically links or statically links to wxWidgets.
- wxTOOLKIT_PREFIX see documentation on this elsewhere. If you're not using msw then change this so that the appropriate libraries will be linked to.
- wxMSVC_VERSION Safe to leave this blank, unless you intend to use multiple builds of wxWidgets with multiple versions of the MSVC compiler.
- Print MSBuild Variables during compile? Think of this as a verbosity flag. If you encounter problems turn this on, and inspect the Output pane of visual studio to diagnose the problem(s).
- Build wxWidgets library? Will check to see that wxWidgets is built and up to date before building your project. If the target wxWidgets build isn't built, it will build it for you. Turn this off to speed up compilation time (as it skips the check). If you want additional flags handled email the author of the wxWidgetsTemplate NuGet package.
When you build the project it will automatically build wxWidgets, define the necessary preprocessor directives, and link to the appropriate libraries. If dynamically linking to wxWidgets, it will set up hard links to the *.dll's within the output folder.
The options you choose here will be stored in a *.user file. Do not version this file in SCM, these are the user's options.
The package will automatically create and use a precompiled header file for you, if you had not already. Define NOPCH to disable this feature. See CreatePrecompiledHeaderFileProcess.cpp within the package for more information.