Problem: VS 2012 "Cannot Save File" while using Resource Editor

Article ID: 2839032 - View products that this article applies to.
Expand all | Collapse all

Symptoms

You are using Visual Studio 2012, where you are editing a Visual C++ project and making changes to a dialog in the Resource Editor. An unexpected message box appears with the error message:

Collapse this imageExpand this image
Cannot Save File

Cause

There is an issue with how the AutoRecover feature is interacting with the Resource Editor. When the resource being edited has not been saved when the AutoRecover interval expires (the default is every 5 minutes), AutoRecover tries to save the resource files. During this, it tries to save a file named resource.hm. Resource.hm is used when you are using Context-Sensitive Help, an option when generating a native UI project. When you have it enabled, it creates help IDs that get written to the help ID header file, resource.hm. There will not be any resource.hm unless you enable the "Help ID" property for one or more of your resources.

Resolution

  1. Avoid AutoRecover save of edited resources.
    a. Disable the AutoRecover option in Tools | Options | Environment | AutoRecover, by unchecking the "Save AutoRecover information every:" checkbox:
    Collapse this imageExpand this image
    Tools | Options | Environment | AutoRecover

    b. Save your edited resources within the specified interval to avoid the triggering of Auto-Save. You may increase the interval, but this also increases the risk of losing unsaved work.
  2. Don't use context-sensitive help
    a. If you are not using context help ID’s, then turning that off for every control would be the easiest solution. Turning it off from the resource editor would be safest. In the resource editor, check for all the controls and one of the properties will be Help ID. Set it to "False" for every control where it is "True".
    Collapse this imageExpand this image
    Control Properties Help ID

    b. Alternatively you could edit the .rc file directly. For instance, removing the last parameter here for every control with a Help ID would turn off the feature:
    DEFPUSHBUTTON "OK",IDOK,103,31,50,14,WS_GROUP,0,HIDOK

More information

See this blog article about AutoRecover: Ultimate Visual Studio Tips & Tricks
Note This is a "FAST PUBLISH" article created directly from within the Microsoft support organization. The information contained herein is provided as-is in response to emerging issues. As a result of the speed in making it available, the materials may include typographical errors and may be revised at any time without notice. See Terms of Use for other considerations.

Properties

Article ID: 2839032 - Last Review: April 17, 2013 - Revision: 1.0
Applies to
  • Microsoft Visual Studio Professional 2012
  • Microsoft Visual Studio Premium 2012
  • Microsoft Visual Studio Ultimate 2012
Keywords: 
KB2839032

Give Feedback

 

Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from smallbusiness.support.microsoft.com