Saturday, April 25, 2015

Batch build vdproj

As I mentioned in a different blog post, support for vdproj (Visual Studio setup) projects was removed in VS2010, then it quietly returned as an optional extension for VS2013. After resurrecting some old setup projects I decided I needed to build them in batch scripts. I remember several years struggling for an hour to find the correct syntax of the command required to batch build a vdproj file. It turns out you need something like this sample:

"<path>\devenv" foo.sln /Project setup/foo.vdproj /Build Debug

The arguments are fragile and you must specify the path of the sln file first, then /Project specifies the path to the vdproj file (which is a part of the solution), then other switches which are documented HERE. If you get anything slightly wrong then all you get is the devenv help display. However, this time, all I could get out of this command was:

ERROR: An error occurred while validating.  HRESULT = '8000000A'

For ages I thought it was my fault due to a syntax error or a version stuff up. Then I ran a web search and found it was a known problem. The fix/workaround is documented HERE. You have to add this DWORD value to the registry:

HKCU
  Software
    Microsoft
      VisualStudio
        14.0_Config
          MSBuild
            EnableOutOfProcBuild = 0x0

This dreadfully obscure change allows the devenv command to work correctly. I'm quite angry about this as it took me over an hour to defeat the problem and document it.
Update July 2017 -- This post was updated for more recent versions. All of the information above was confirmed using Visual Studio 2015.

No comments:

Post a Comment