views:

127

answers:

1

Is there anybody using MSTest to test MFC code?

I created a managed C++ Test project and and can write unit tests within it but once I #include <afxwin.h> then I have problems. The code will compile and when it gets to running the tests, the UI hangs and none of the symbols will load. You cannot debug the tests either. If I remove the #include, then the tests will run successfully. Any ideas?

It is compiling with /clr with multithreaded debug (/mtd) and using MFC through a shared dll. If I choose to statically link to MFC, then the compiler (VSVC9.0) will tell me that /clr and /mtd are not compatible.

Also, do you think adding DependencyInput's to the tests will fix this? I've tried adding some MFC dlls as dependency inputs but it hasn't helped. I could be doing it wrong though.

Thanks.

A: 

Is it the same from the command line?

Not done this. But could a static window be being created? check the msest proces with process explorer.

Preet Sangha