I recently encountered a problem creating new logins with SQL Server. Something that has worked for years suddenly stopped with the following error:

Password validation failed. The password does not meet Windows policy requirements because it is too short.

Since SQL Server was using Windows local security policy I went and checked that at Security Settings > Account Policies > Password Policy in Local Security Policy (available under Administrative Tools in Control Panel or by opening secpol.msc). As expected, these contained setting that I was not expecting, which were probably changed from the network by a system administrator.

However, I wanted to be able to enter shorter passwords, like 8 characters instead of 10, but this was disabled. Even if I was running as administrator, the option of changing this was disabled.

It is however still possible to modify these settings even if you cannot do it from the management console. You can do it from a command prompt as administrator.

  1. Open a command prompt running as administrator
  2. Run the following command to export the settings to a file. In my example, the target path is c:\temp\local.cfg, but it can be anything.

  3. Edit the file with notepad or another editor. The file is an INI file with sections and key-value pairs. The password settings are available under the [System Access] section. For changing the minimum length of the passwords modify the MinimumPasswordLength key.
  4. Save the file and run the following command to import the settings from the modified file.

  5. Close and open the Local Security Policy console again and check the settings.
, , , , Hits for this post: 1726 .

Visual Studio 2015 comes with many new features and improvements in the IDE, the debugger or language compilers. Obviously, there are more than three things I like in the new IDE, but three things have caught my attention from the very beginning.

The Error Window

vs2015error1
One of the things that bothered me the most about the error window was the mixture of errors/warnings/messages from both MSBuild and IntelliSense. But I don’t usually care about the later and their presence in the error window is usually annoying me. This is now fixed and you can select to see messages from Build, IntelliSense or both.
vs2015error2
In addition to this you can apply even more filtering:

  • You can select the source of the messages: Entire Solution, Current Project, Open Documents or Current Document.
    vs2015error3
  • You can search the error list, and the search includes the text in all the output list columns (Code, Description, Project, File or Line).
    vs2015error4
  • You can individually show or hide Errors, Warnings and Message (but this feature has been available for many years).

The Find in Files Append

I’m working with large source bases and I often need to do find in files, usually going from search to search until I find what I need. The problem was there were only two output windows for the search results and when you need to do a 3rd you had to discard one of the previous searches while you might still needed the results. I have requested for many years that Visual Studio should support more than two find results windows. I actually created a User Voice request a few years ago.

In Visual Studio 2015 they have implemented an append feature, were you could append your search results to one of the existing two windows.

vs2015find1

As a result the old search results are not discarded, but aggregated in a the form of a tree list in the search results window.

vs2015find2
vs2015find3

Though this is not what exactly I was expecting it provides the feature I was looking for with probably minimal changes to the Visual Studio IDE.

The Inline Create Definition (for C++)

I’m not sure how this feature is actually called, but what it does is creating a definition for a function in the source file from the declaration in the header and displays it in a boxed document inside the header document. Here is an example:

You declare a function/method in a header file. Visual Studio figures out the definition is missing.
vs2015inline1
Use the Quick Actions (CTRL + .) to create a definition of the symbol in the source file.
vs2015inline2
The definition is added to the source file that is opened as a document in a box just below the function declaration.
vs2015inline3
I find this very useful to get going with a new function. Of course for writing larger functions you’ll probably switch to the actual document tab where the source file is opened.

With these new features only Visual Studio has become much more productive for me. And there are plenty more.

, , Hits for this post: 12437 .

I have tried to assemble together information about the Visual C++ releases, the compiler and the frameworks (MFC and ATL). You can find these on many places, but it is often incomplete or focused on something particular (Visual Studio, C++ compiler, framework, etc.).

The table below is the result of this effort. It is incomplete because it’s not easy to find information about products released more than two decades ago, but if you can help filling in the gaps please drop a comment with the information you have and I will update the table.

Product Codename Release date C++ version _MSC_VER MFC version _MFC_VER ATL version _ATL_VER
C 1.0 100
C 2.0 200
C 3.0 300
C 4.0 400
C 5.0 500
C 6.0 1990 600
C/C++ 7.0 1992 700 1.0 0x0100
Visual C++ 1.0 Caviar 1993 1.0 800 2.0 0x0200
Visual C++ 1.1 Barracuda 1993 1.1
Visual C++ 1.5 Dolphin 1993 1.5 850 2.5 0x0250
Visual C++ 1.51 1.5
Visual C++ 1.52 1.52
Visual C++ 1.52b 1.52b
Visual C++ 1.52c 1.52c
Visual C++ 2.0 2.0 900 3.0 0x0300
Visual C++ 2.1 2.1
Visual C++ 2.2 2.2
Visual C++ 4.0 Olympus 1995-12-11 4.0 1000 4.0 0x0400
Visual C++ 4.2 4.2 1020 4.2 0x0420
1.0 0x0100
1.1 0x0110
2.0 0x0200
Visual Studio 97 Boston 1997-04-28 5.0 1100 4.21 0x0421 2.1 0x0210
Visual Studio 6.0 Aspen 1998 6.0 1200 6.0 0x0600 3.0 0x0300
Visual Studio .NET 2002 Rainier 2002 7.0 1300 7.0 0x0700 7.0 0x0700
Visual Studio .NET 2003 Everett 2003 7.1 1310 7.1 0x0710 7.1 0x0710
Visual Studio 2005 Whidbey 2005 8.0 1400 8.0 0x0800 8.0 0x0800
Visual Studio 2008 Orcas 2008 9.0 1500 9.0 0x0900 9.0 0x0900
Visual Studio 2010 Dev10 2010 10.0 1600 10.0 0x0A00 10.0 0x0A00
Visual Studio 2012 Dev11 2012-08-15 11.0 1700 11.0 0x0B00 11.0 0x0B00
Visual Studio 2013 Dev12 2013-10-17 12.0 1800 12.0 0x0C00 12.0 0x0C00
Visual Studio 2015 Dev14 2015-07-20 14.0 1900 14.0 0x0E00 14.0 0x0E00

Several notes on the history of VC++:

  • Visual Studio 97 was the first product that bundled together several products (Visual C++, Visual Basic, Visual J++)
  • Visual Studio 6.0 is the only version of Visual Studio that was not named after the release year, but the version number
  • MFC was first release in 1992 with C/C++ 7.0
  • MFC 6.0 released with Visual Studio 6 did not change the name of the MFC DLLs, that were still named mfc42.dll
  • ATL was first released in between Visual C++ 4.2 and Visual Studio 97. The first release of the framework to be included in a product was ATL 2.1 released with Visual Studio 97
  • Visual C++ version 3.0 was skipped to 4.0 to align the product version with the MFC version, whose next version was 4.0
  • Visual Studio 2015, the compiler and framework version are 14.0 and not 13.0, a number which was skipped (for the good old superstitions)
  • _MFC_VER and _ATL_VER macros were initially incorrectly documented in MSDN as 0x1000 instead of 0x0A00

References

, , , Hits for this post: 18127 .

If you work on a Apache Cordova project in Visual Studio 2013 using Visual Studio Tools for Apache Cordova CTP 3 or 3.1 you should know there are important breaking changes in migrating the project from Visual Studio 2013 to Visual Studio 2015. The project can be migrated, but you have to do everything manually, as Visual Studio is not able to apply the changes automatically.

First of all, Visual Studio Tools for Apache Cordova CTP3.x are not longer supported in Visual Studio 2013 in the first place. If you try to install Update 5 it will prompt you to remove it before continuing.
vs2013u5
This is explained in the release notes for Update 5.

Also note: All prior releases of the Tools for Apache Cordova are incompatible with Update 5. If you have previously installed a Tools for Apache Cordova CTP extension, you must uninstall that extension before installing Visual Studio 2013 Update 5. If you require Apache Cordova support, we encourage you to try Visual Studio 2015.

The options for those developing with the VS tools for Apache Cordova in VS2013 are either to switch to Visual Studio 2015 or not install the last update and continue to work with CTP 3.x in VS2013.

In this article I will show you how to migrate a Cordova application from VS2013 to VS2015 and I will exemplify with a test application.

I have this app called TestApp. It’s built with Ionic and AngularJS. It is a JavaScript app, not a TypeScript app, but this works just the same regardless what language you use. It has the following project structure, with the Javascript source code in a folder called app, the libraries in libs and the templates in views. There are other folders apart from the ones VS has created, mainly css and images.

vs2013proj1 vs2013proj2

The application is just a test, it doesn’t do anything but it works for both Android and iOS.

ripple1 ripple2

When you open this project in Visual Studio 2015 it is not loaded. Visual Studio complains that “This project is incompatible with the current edition of Visual Studio.”
vs2015proj1
You have to covert it manually in order to make it available for Visual Studio 2015. Fortunately, the steps to do this are documented, but not in MSDN as one might expect, but on GitHub. There is a document called Known Issues – Visual Studio 2015 that explains what has to be done.

  • Create a new empty Apache Cordova app. The only purpose of this app is to copy from files to your actually project.
    vs2015proj2
  • Copy the .jsproj and taco.json files into the project folder of the application you migrate. Make sure you overwrite the existing .jsproj with this new project file.
  • Delete the existing bin and bld folders
  • Create a folder called www
  • Move everything except for config.xml and folders merges, res and plugins to the www folder.

If you open the project again in Visual Studio 2015 it will work and you can build and run it. For my test application the new project looks like this.
vs2015proj3

You can see that the all the folders and files under the www folder appear automatically in the solution explorer. They are not added with a Content or Folder element in the .jsproj file. You can make a comparison of the old and new .jsproj and see how simplified the new file is.
jsprojcompare1

Another thing to notice here is that the NodeJS module used for building the project is no longer called vs-mda (i.e. Visual Studio Multi-Device Application) but vs-tac (i.e. Visual Studio Tools for Apache Cordova).
jsprojcompare2

However, when I tried to build I got the following error:

MSBUILD : cordova-build error BLD401: Error : BLD00401 : Could not find module ‘delayed-stream’] code: ‘MODULE_NOT_FOUND’. Please Go to Tools –> Options –> Tools for Apache Cordova –> Cordova Tools –> Clear Cordova Cache and try building again.

This might have been related to the version of Apache Cordova I had globally installed, i.e. 5.1.1. If you get the same install it via npm.

However, you may still get problems when you try to build for Android.

MSBUILD : cordova-build error BLD10205: Please install Android target “”
You may not have the required environment or OS to build this project
MDAVSCLI : error : cmd: Command failed with exit code 2

The Android target name is empty, but if you do a Rebuild you get more information and actual required target name:

[Error: Please install Android target: “android-21”.

Hint: Open the SDK manager by running: C:\Program\ Files\ (x86)\Android\android-sdk\tools\android.BAT
You will require:
1. “SDK Platform” for android-21
2. “Android SDK Platform-tools (latest)
3. “Android SDK Build-tools” (latest)]
C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\ApacheCordovaTools\vs-mda-targets\Microsoft.MDA.FileMirroring.targets(352,5): error MSB3073: The command “platforms\android\cordova\clean.bat” exited with code 2.

These can be installed using the Android SDK Manager. Make sure you select all the mentioned components.
android1
With these changes you can build successfully for Android.

One more thing here is the version of Apache Cordova used by vs-tac to build. vs-tac uses Cordova 4.3.1, but I already had Cordova 5.1.1 installed on my machine and used by vs-mda. If you have a newer Cordova version than 4.3.1 what you have to do instruct vs-tac to use this one in the taco.json file.

Replace the version 4.3.1 of the cordova command line interface with desired version (in my case 5.1.1). When you rebuilt it will install it and build with it.

Your environment has been set up for using Node.js 0.12.7 (x64) and npm.
—— Ensuring correct global installation of package from source package directory: C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\Extensions\ApacheCordovaTools\packages\vs-tac
—— Name from source package.json: vs-tac
—— Version from source package.json: 1.0.0
—— Package already installed globally at correct version.
—— Installing Cordova tools cordova@5.1.1 for project from npm. This could take a few minutes…

You can find the various Cordova versions installed under %APPDATA%\npm\node_modules\vs-tac\node_modules\cordova.
vstac3

For more information see:

, , , , Hits for this post: 18425 .

guidgen.exe is a small utility that comes with Visual Studio and generates GUIDs in a variety of formats. The problem with the tool is that it does not format GUIDs in plain text, which I happen to need many times (in source code, database tables, etc.) and I suppose is a feature needed by many developers. There are a couple of variants of the tool on Codeproject (GUIDGen Developer Studio AddIn and GUIDGen AddIn for Visual Studio.NET) but they lack some of the new formats supported by guidgen.

GUIDGEN.exe from Visual Studio

GUIDGEN.exe from Visual Studio does not have plain text formatting or case options.

Modified GUIDGEN has plain text formatting and case option but does not support all formats from Visual Studio’s GUIDGEN (i.e. C# and VB.NET Guid attribute format)

I have decided to create another modified version of GUIDGEN in order to support additional formats, including plain text, and also case options.

guidgen used to be available as an MFC sample, but that doesn’t seem to be the case any more. However, the sample from Visual Studio 2005 is still available on MSDN and I used that as a starting point. The result is a tool very similar to guidgen.exe from Visual Studio (2013 or 2015) but with additional features:

  • two more formats: __declspec(uuid("xxxxxxxx-xxxx...xxxx")) and plain text
  • case option: upper case (default) or lower case
guidgen2 guidgen3

The existing guidgen executable is available in the Common7\Tools folder of Visual Studio (i.e. c:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\Tools\ for Visual Studio 2013). You can replace that version with this build or put it somewhere else and keep it side by side by adding a new command from Tools > External tools. This might be more practical if you have several versions of Visual Studio installed.

guidgen-externaltools

Here are the downloads:
Guidgen-src (753) – Source code as Visual Studio 2013 solution
Guidgen-binaries (700) – Executables built with MFC as a shared library
Guidgen-mfcstaticlib-binary (745) – Executables built with MFC an a static library

, , , , , Hits for this post: 17427 .

Visual Studio Tools for Apache Cordova (VSCordovaTools for short) is a great Visual Studio toolset to develop hybrid applications for multiple platforms, including Android, iOS and Windows. One of the nice things about the tool is that it installs everything you need to develop with Cordova. You don’t have to care about installing multiple components, runtimes, setting system environment variables, etc. However, one of the drawbacks is that it is not currently supporting updating those components to newer versions.

The latest release available for VS 2013 is CTP 3.1 and this build comes with Cordova 3.5.0. Should you need to use a newer version you have to do it manually. In this blog post I will list all the steps you need to do to update to the latest version Cordova (currently 5.1.1) both on Windows and on Mac (where you build the iOS version of the hybrid apps). However, in these steps I will also include how to update Node.js and npm.

Update Cordova on Windows

Note: Make sure you close all instances of Visual Studio before starting this process.

  1. Download and install the latest version of Node.js from nodejs.org.
  2. Update npm. To check your current npm version run the following command in a console:

    To update to the last version of npm run the following command in a console (elevated As Administrator):
  3. Update Cordova. To check your Cordova version run the following command in a console:

    To update to the last version of cordova run the following command in a console (elevated As Administrator):
  4. Update the vs-mda version of Cordova with the latest you just installed in the previous step. Cordova is (globally) installed at %APPDATA%\npm\node_modules\cordova. vs-mda copy of Cordova is available at %APPDATA%\npm\node_modules\vs-mda\node_modules\cordova. Replace the entire content of this folder with the one of the global Cordova installation.
  5. Install missing modules (this might depend on the latest version you install). For 5.1.1 I had to install concat-map and balanced-match. If anything else is necessary it should show up in the output log when you build your Cordova project.

Update Cordova on Mac

Note: Make sure you stop the vs-mda-remote agent before performing this upgrade.

  1. Open a Terminal session and run the following command:
  2. Update the vs-mda-remote version of Cordova with the the latest you just installed in the previous step. Cordova is (globally) installed at /usr/local/lib/node_modules/cordova. vs-mda-remove copy of Cordova is available at /usr/local/lib/node_modules/vs-mda-remote/node_modules/cordova. Replace the entire content of this folder with the one of the global Cordova installation.
  3. Restart the vs-mda-remote agent.

With all these installed you should be all set to start building with the latest version of Cordova.

, , , , , , Hits for this post: 17251 .

Several CTPs for Visual Studio 2014 have been released so far. The 3rd and 4th CTPs can be actually used with a Windows Azure Virtual Machine. If you have a Windows Azure account you can go ahead and create a VM. If you are an MSDN Subscriber or you have a trial account, you have a number of free hours that you can use, so you won’t have to pay anything to run VS2014 CTP in the clound.

NOTE: Details about the limits and cost in Windows Azure are available here (also see this article).

Below is a step-by-step walk through of how to create and start a VM for Visual Studio 14 CTP 4.

Step 1: Log to Windows Azure.

Step 2: Create a new virtual machine.

In the Azure portal press the New button.
azure_vs2014ctp_1

Select Compute > Virtual Machine > From Gallery
azure_vs2014ctp_2

Choose the Visual Studio 2014 CTP 4 Image
azure_vs2014ctp_3

Select the virtual machine configuration
azure_vs2014ctp_4

azure_vs2014ctp_5

azure_vs2014ctp_6

Step 3: Wait until the virtual machine starts up.

This may take a few minutes.
azure_vs2014ctp_7

azure_vs2014ctp_8

Step 4: Connect remotely to the virtual machine.

See How to Log on to a Virtual Machine Running Windows Server.

Note: You have to authenticate with the username (make sure you use the format machinename\username) and the password you have created, not the account you are initially prompted in the RDP window.

azure_vs2014ctp_9

Step 5: Launch and use Visual Studio 2014 CTP.

azure_vs2014ctp_10

, , , , Hits for this post: 18583 .

Visual Studio 2012 introduced a new framework for writing debugger visualizers for C++ types that replaced the old autoexp.dat file. The new framework offers xml syntax, better diagnostics, versioning and multiple file support.

Visualizers are defined in XML files with extension .natvis. These visualizers are loaded each time the debugger starts. That means if you make a change to visualizers, it is not necessary to re-start Visual Studio, just re-start the debugger (for instance detach and re-attach the debugger to the process you debug).

These files can be located under one of these locations:

  • %VSINSTALLDIR%\Common7\Packages\Debugger\Visualizers (requires admin access)
  • %USERPROFILE%\My Documents\Visual Studio 2012\Visualizers\
  • VS extension folders

In Visual Studio “14” CTP (in response to a UserVoice request) these files can also be added to a Visual C++ project for easier management and source control integration. All you have to do is add the .natvis file to your .vcxproj file.

Here is an example. Suppose we have the following code:

If you run this in debugger you can inspect the value of p and it looks like this:
natvis1

To change the way the point objects are visualized create a file called point.natvis with the following content:

Add this file to the project.
natvis3
When you run the application in debugger again the point object is visualized according to the per-project .natvis file.
natvis2

UPDATE
There are two things to note:

  • changes in the natvis files are now picked up automatically by the debugger; you no longer need to stop the debugging session and then start again if you make changes to a natvis file
  • natvis files from the project are evaluated after all the other files from the other possible locations; that means you can override existing (general) visualizers with project-specific visualizers

For more see Project Support for Natvis.

, , , , , Hits for this post: 27842 .

Visual Studio 2012 provides support for new features, such as code review and feedback through the use of the Work Item tracking system in TFS. (You can read more about it in this article New Code Review feature in Visual Studio 2012).

However, to be able to use these features you must use a process template that supports them. If you try to access these features without upgrading the process template you get errors.

This feature can’t be used until your Team Foundation administrator has enabled it on the team project.

To use My Work to multi-task and manage your changes, you must enable the feature on the server.
Click here to enable the new features

features1
features2

The error in the verification step for configuring the team project happen because an old process template is in use.

If your current process template is MSF for Agile Software Development version 4.x then you need to follow the steps in this article: Update a Team Project Based on an MSF v4.2 Process Template.

To being able to update, you first have to download the latest version of the process template. You can do this from Visual Studio. Go to Team > Team Project Collection Settings > Process Template Manager and download the template.
updatetemplate2

After you have the process template files go ahead and update according to the steps defined in the before mentioned article. However, there is a missing command in the first step of the process. You need to change an additional system field than those mentioned in the article:

If you need to do this for multiple projects then you’ll have to run most of these steps for each project. So here are two batch files with commands you need to run:

  • update the Team Project collection (run only once):

    Note: Make sure you set the correct URL to your collection and replace TemplateDir with the actual path of the process template that you downloaded.

  • Update the Team Project (run once for each project)

    You execute the batch passing the name of the project (in quotes if it contains spaces).

After these commands have executed successfully you can go ahead and use the new features.
updatetemplate3

, , , , , Hits for this post: 23929 .

Speed-up VC++ builds

The larger a VC++ project is (or any project for that matter) the more time it takes to build. If you have solutions with many large projects the build times could get into your way. Starting a rebuild and going to lunch was a common scenario for me, as building took 20-25 minutes. Of course, you don’t rebuild everything all the time, but sometimes is enough to change something in a header somewhere deep inside the dependency web and trigger a rebuild of many or all the projects in a solution.

Using compiler switches and other tricks I managed to reduce the build time with about 50% or more (the percent of speedup is similar on different machines, regardless of the previous build times on those machines). Replacing the hard disk with an SSD provided an additional 25% speed. My full build times have decreased from 20-25 minutes to about 7 minutes.

First off all, Visual Studio enables parallel projects builds by default. As long as your projects don’t have dependency and can be built in parallel, it is possible to have up to 32 projects built at the same time. By default the number of projects built in parallel is set to the number of available cores. This option can be change from Tools > Options > Projects and Solutions > Build and Run.

vcbuild1

The VC++ compiler also supports multi-processor compilation. This can be enabled with a compiler switch, /MP. The result of this switch is that the compiler spawns into additional processes that simultaneous compile the source files. This option can be set per project from Project > Properties > Configuration Properties > C/C++ > General.

vcbuild2

This option is however incompatible with several compiler and language features. In case of incompatibility the behavior differs:

  • if the incompatibility is with another compiler option a warning is displayed and the /MP options is ignored
  • if the incompatibility is with a language feature an error is issued and compilation stops or continues depending on the error level

The incompatible features are: #import processor directive, /GM (enables incremental build), /Yc (writes a precompiled header file), /E and /EP (copies pre-processor output to the standard console), /showIncludes (writes a list of include files to the standard error console). These features are incompatible with /MP because they would imply shared resources (console or file) to be used possible at the same time from different processes.

The workaround for the #import processor directive is to move the directives to a file that is not built with the /MP option. However, in practice I had problems with that and the workaround that actually worked was to move the #import directives to the pre-compiled header. That is built (the corresponding source file actually) synchronously before the compilation of any other translation unit starts, so there are no incompatibilities. However, this has the drawback that any change in the imported type library will trigger a rebuild of the precompiled header and of the whole project.

vcbuild3

Below is a table of full build times for various VC++ projects from the same solution. The values were reported by MSBuild. The actual time values (shown to hundredths of a second) are not important (as they vary across builds and machines). What is important is the speed-up before enabling /MP and after it.

Before After
Release Debug Release Debug
00:00:58.43 00:00:53.14 00:00:37.32 00:00:25.23
00:00:45.41 00:00:33.25 00:00:12.16 00:00:07.47
00:00:56.85 00:00:54.90 00:00:51.35 00:00:50.72
00:00:45.41 00:00:44.34 00:00:24.41 00:00:20.16
00:01:00.92 00:01:05.97 00:01:15.40 00:01:14.07
00:04:17.89 00:04:25.88 00:01:34.66 00:01:17.97
00:02:59.41 00:02:26.42 00:01:11.99 00:00:54.07
00:00:46.96 00:00:43.96 00:00:17.70 00:00:17.41
00:00:46.05 00:00:46.05 00:00:16.69 00:00:14.40
00:01:44.84 00:01:35.11 00:00:30.29 00:00:28.13
00:00:11.02 00:00:14.26 00:00:07.97 00:00:08.24
00:00:09.28 00:00:12.75 00:00:07.59 00:00:07.59
00:00:08.46 00:00:08.95 00:00:10.89 00:00:08.25
00:00:18.68 00:00:19.79 00:00:14.32 00:00:11.35
00:02:46.37 00:00:50.76 00:01:52.16 00:00:28.88
00:00:13.87 00:00:11.66 00:00:09.24 00:00:11.06
00:01:05.37 00:00:54.76 00:00:25.45 00:00:26.83
00:00:29.00 00:00:16.68 00:00:13.32 00:00:12.94
00:00:25.79 00:00:14.05 00:00:12.09 00:00:12.04
00:00:22.80 00:00:11.50 00:00:11.60 00:00:11.93
00:00:31.76 00:00:39.33 00:00:25.00 00:00:21.19
00:00:56.01 00:00:59.04 00:00:26.62 00:00:23.95
00:00:20.40 00:00:12.92 00:00:08.64 00:00:07.99
00:00:16.48 00:00:18.61 00:00:09.18 00:00:08.71
00:00:09.74 00:00:10.49 00:00:06.84 00:00:09.84

Another strategy for increasing the build times is to reduce the number of times framework headers (STL, MFC, ATL, etc.) or headers from your project that do not change often and are included in many places are included into the various source files of your projects. These headers can be put in the pre-compilead header, and therefore compiled just once.

The next table shows the additional speed-up gain for several projects after moving framework headers to the pre-compiled header of each project.

Before After
Release Debug Release Debug
00:00:37.32 00:00:25.23 00:00:32.79 00:00:19.24
00:00:12.16 00:00:07.47 00:00:04.90 00:00:02.41
00:00:51.35 00:00:50.72 00:00:44.15 00:00:37.25
00:00:24.41 00:00:20.16 00:00:20.19 00:00:20.16
00:01:15.40 00:01:14.07 00:01:14.10 00:01:10.56
00:01:34.66 00:01:17.97 00:01:23.60 00:01:22.15
00:01:11.99 00:00:54.07 00:01:11.70 00:00:43.20

The speed-up gain by using these techniques may vary depending on your project specifics. In some cases the gain may not be significant or the build time may actually increase. You should play around with these settings and enable them only when they help you.

In summary, some of the strategies that can help increase your build times are:

  • break dependencies between projects they can be built in parallel
  • if you have large projects try to break them in smaller, independent projects; the more such projects you have the more work can be done in parallel
  • use multi-processor compilation (/MP) for C++ projects to enable compiling multiple translation units at the same time
  • move framework headers (STL, MFC, ATL, etc.) and other headers that do not change and are included all over your project to the pre-compiled header
  • use a SSD and keep your sources on it
, , , , , Hits for this post: 26755 .