Today VS2008 SP1 pop up an error dialog when I was editing MFC dialog box in VS2008 SP1. The error was saying something like "Cannot add event handler because code element CMainDlg marked as read-only". Clearly neither .cpp nor .h file for this class was not marked as read-only. Actually none of files in directory were marked as read-only. I have tried fixing the proble with several tricks, but what finally worked for me is the following:
- Save all files and close solution
- Delete <your project name>.suo file
- Delete <your project name>.<username>.user file
- Delete <your project name>.ncb
- Delete <your project name>.aps
- Load solution in Visual Studio again and re-try the action.
Exactly these steps fixed the problem for me. Now I believe it may be sufficient to only do steps#1 to step #5 to step#6. .aps file is most likely the root cause of the problem here. If anyone tries deleting .aps file only and it fixes the problem, please let me know in comments.