I’m currently working on updating one of our core projects to compile on Visual Studio 2012. These upgrades can sometimes be seamless. More often than not, though, there’s some issues that have to be resolved manually. Posting this up in hopes it might save someone out there some time if they’re hitting the same issues.
Before anything else it’s worth taking a look at the C++ breaking changes in VS2012. If I had done this first thing I would have saved some time trying to figure out why I couldn’t find afxcomctl32.h. The answer is it was removed.
Removed Fusion support (afxcomctl32.h); therefore, all methods that are defined in afxcomctl32.h have been removed. Header files afxcomctl32.h and afxcomctl32.inl have been deleted.
You can find for more information on activation contexts at http://msdn.microsoft.com/en-us/library/aa374153(v=vs.100).aspx
Item 1: Solution Configuration Combo Box
This one is just an annoyance, but worth posting up. The VS2012 standard bar doesn’t have an obvious way to resize the Solution Configuration combo box.
I was able to find the solution to the problem here:
- Solution Configuration on Standard toolbar cuts off text (click the ‘workaround’ tab)
Item 2: Error CA0053
Visual Studio 2010 apparently hard-codes some paths which cause issues for projects being upgraded. Solution info is here:
- Error CA0053 due to failure to load rules DLL when running code analysis
- How to fix the CA0053 error in Code Analysis in Visual Studio 2012
Item 3: makehm.exe errors
We have a custom build step that runs makehm.exe at the end of the build process. It kept generating an error and reporting that it was unable to open the output file. It looks like it’s just a bug with the program. It’s easy enough to work around by not specifying output and just using redirection to dump stdout output to a file. So instead of:
makehm.exe input_parameters_here output_file
change your command to
makehm.exe input_parameters_here > output_file
Item 4: warning RC4011: identifier truncated to ‘_CRT_SECURE_CPP_OVERLOAD_STANDA’
This error is caused by non-standard #include directives in your .rc files. In my case there was an “#include richedit.h” that was generating the issue. If not for Google this might have proved very difficult to track down as there is no clear indication what the culprit is. As you’ll find in the first link below:
RC files usually just include resource.h (which is just a list of #defines for control identifiers in your dialogs, etc.) and afxres.h (which includes winres.h and is like a cut-down version of the windows
Item 5: SAFESEH
The error at hand is “error LNK2026: module unsafe for SAFESEH image.”
Apparently when the project was upgraded the switch was turned on whereas previously the project had contained no value for this Advanced Linker switch.
If /SAFESEH is not specified, the linker will produce an image with a table of safe exceptions handlers if all modules are compatible with the safe exception handling feature. If any modules were not compatible with safe exception handling feature, the resulting image will not contain a table of safe exception handlers.
So you can either rebuild the libraries responsible for the error or you can disable it for the project you are building. Be aware there may be security implications to consider if you decide to turn the switch off. You can do so by going to the properties for the project and under Linker->Advanced the very last item should be “Image Has Safe Exception Handlers.” You can explicitly disable or just delete the entry to rely on default behavior.
Item 6: Casting Errors
This post at Stack Overflow captures my issue. Essentially a casting operation that was working in VS2010 stopped working when I tried to compile the exact same code in VS2012.
Item X: BuildShadowTask
- Not solved yet. Links below are errors and links that might help.
- warning: This task to create private accessor is deprecated and will be removed in a future version of visual studio