I'm in the process of working on a legacy project that was written in C++/CLI as a Windows Application with everything being compiled into a single .exe file. Since I've been tasked with writing some mathematically complex code I want to add unit testing to the solution. Upon doing so (Solution > Add > New Project > Managed Test Project) and attempting to add the project as a reference to the test project I get the following error:
The main project is configured as "Pure MSIL Common Language Runtime support (/clr:pure)" and everything obvious seems to be in order, but I keep getting the error message. How can I get the solution setup to include the Unit Testing Framework?
Google Search Phrase: Add Unit Tests to C++/CLI Project
As it turns out and was eluded to by a commenter, you can't use the C++ Test Projects when writing tests for C++/CLR. The workaround that we found is as follows:
Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll
ours is version 14.0.23107.0#include
headers from the other project, Visual Studio will resolve them for youWe also verified that the tests can be run through the Unit Test Session in ReSharper 10.0.2.