Unexpected exception when setting CommandLine property of VCCustomBuildTool - by fnqbruce

Status : 

  Won't Fix<br /><br />
		Due to several factors the product team decided to focus its efforts on other items.<br /><br />
		A more detailed explanation for the resolution of this particular item may have been provided in the comments section.

Sign in
to vote
ID 776854 Comments
Status Closed Workarounds
Type Bug Repros 0
Opened 1/17/2013 5:57:26 PM
Access Restriction Public


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 property

However, only using the debugger reliably prevents the exception. 

Please note that this problem does not occur in Visual Studio 2010.
Sign in to post a comment.
Posted by Microsoft on 7/9/2013 at 11:38 AM

Thank you for taking the time to provide your feedback. After reviewing your reported issue, in the context of all the issues reported to us, we have decided not to take any action on this feedback at this time.

If this issue is severe, causing critical business situations or blocking your product development or deployment, please go to http://support.microsoft.com or call 1-800-MICROSOFT for assistance.
For Microsoft premier customers, please contact your administrator, your Technical Account Manager, or your Microsoft premier account representative.

Bogdan Mihalcea
VC++ Team
Posted by Microsoft on 1/18/2013 at 2:35 AM
Thank you for submitting feedback on Visual Studio and .NET Framework. Your issue has been routed to the appropriate VS development team for investigation. We will contact you if we require any additional information.
Posted by Microsoft on 1/17/2013 at 6:51 PM
Thank you for your feedback, we are currently reviewing the issue you have submitted. If this issue is urgent, please contact support directly(http://support.microsoft.com)