Solution() { // try the VS Express version first, since it's free var registryKey = @"Microsoft\VCExpress\9.0\Projects"; if (Bam.Core.Win32RegistryUtilities.Does32BitLMSoftwareKeyExist(registryKey)) { vsEdition = "Express"; } else { registryKey = @"Microsoft\VisualStudio\9.0\Projects"; if (Bam.Core.Win32RegistryUtilities.Does32BitLMSoftwareKeyExist(registryKey)) { vsEdition = "Professional"; } else { throw new Bam.Core.Exception("VisualStudio C++ 2008 (Express or Professional) was not installed"); } } using (var key = Bam.Core.Win32RegistryUtilities.Open32BitLMSoftwareKey(registryKey)) { if (null == key) { throw new Bam.Core.Exception("VisualStudio C++ {0} 2008 was not installed", vsEdition); } var subKeyNames = key.GetSubKeyNames(); foreach (var subKeyName in subKeyNames) { using (var subKey = key.OpenSubKey(subKeyName)) { var projectExtension = subKey.GetValue("DefaultProjectExtension") as string; if (null != projectExtension) { if (projectExtension == "vcproj") { ProjectTypeGuid = new System.Guid(subKeyName); break; } } var defaultValue = subKey.GetValue("") as string; if (null != defaultValue) { if ("Solution Folder Project" == defaultValue) { SolutionFolderTypeGuid = new System.Guid(subKeyName); } } } } } if (0 == ProjectTypeGuid.CompareTo(System.Guid.Empty)) { throw new Bam.Core.Exception("Unable to locate VisualC project GUID for VisualStudio 2008 {0}", vsEdition); } #if false // Note: do this instead of (null == Guid) to satify the Mono compiler // see CS0472, and something about struct comparisons if ((System.Nullable <System.Guid>)null == (System.Nullable <System.Guid>)ProjectTypeGuid) { throw new Bam.Core.Exception("Unable to locate VisualC project GUID for VisualStudio 2008"); } #endif }