In a custom VC++ project wizard, immediately after setting a file's ItemType to 'CustomBuild', any attempt to set any of the properties of the CustomBuildTool will result in an exception: "Mismatched PageRule with the wrong ItemType."For example, in the code below, the last line will usually cause the exception: var config = proj.Object.Configurations('Debug'); var file = proj.Object.Files('Sample.txt'); var projectTool = config.Tools('VCCustomBuildTool'); file.ItemType = 'CustomBuild'; var fileConfig = file.FileConfigurations('Debug'); var tool = fileConfig.Tool; tool.CommandLine = 'ECHO Custom build...';A variety of techniques may prevent the exception, including:- Using the debugger- Adding a sleep between setting file.ItemType and setting the CommandLine property- Creating a log file using FileSystemObject and writing to it before setting the CommandLine propertyHowever, only using the debugger reliably prevents the exception. Please note that this problem does not occur in Visual Studio 2010.
Visual Studio/Team Foundation Server/.NET Framework Tooling Version
Steps to reproduce
Operating System Language