Upgrade Issue: Register fails after build ATL project under VC8/VS2005


An ATL/COM project can be built and registered successfully under VC7.1/VS2003. After upgrade this project to VC8/VS2005 using the upgrade wizard, it can be built successfully but can not register. Regsvr32 returns nothing for debug version and no sense message for release version.

Root Cause:

After tried many approaches for 3 days, I found the root cause is the item named "_AFX_NO_OCC_SUPPORT" in the preprocessor definitions. This item is ok with VC7.1, but it will make the COM fails to register after built with VC8.


Just remove this item from preprocessor definitions. It may causes the compile error of "C2371: 'WCHAR' : redefinition; different basic types c:/program files/microsoft visual studio 8/vc/platformsdk/include/odbcss.h 430 ", if you are using the mentioned odbcss.h file in your project. I have solved this problem by copy this file to my local project folder, and comment out the line of "typedef char DBCHAR;". If I find any better solution, I'll update this article.