I am attempting to unit test a Portable Class Library that I've created and I want to make sure it's being tested with the same framework subset that it targets.
Per the Visual Studio ALM + Team Foundation Server blog, the MSTest unit test framework was converted to a PCL in Visual Studio 2012 RC; however, I am unable to create a portable class library and then reference the MSTest framework in VS2012 RTM.
- Browsing in the "References" dialog shows me that no unit testing components are registered as compatible with PCL.
- Adding a manual GAC reference in the project file to
Microsoft.VisualStudio.QualityTools.UnitTestFramework
yields a reference not found build error. - Adding a manual direct assembly reference to
C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\ReferenceAssemblies\v4.0\Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll
yields a build warning saying the UnitTestFramework assembly references an incompatiblemscorlib
version.
I did find (thanks to an early answer) that there is a project type Unit Test Library (Windows Store apps)
that references a different MSTest assembly at C:\Program Files (x86)\Microsoft SDKs\Windows\v8.0\ExtensionSDKs\MSTestFramework\11.0\References\CommonConfiguration\neutral\Microsoft.VisualStudio.TestPlatform.UnitTestFramework.dll
. This project type creates a small no-UI Windows Store app... complete with manifest and everything. It also doesn't allow me to specify which frameworks I'm targeting - it appears to be only for Windows Store apps.
Under the potentially faulty assumption that I should be testing my Portable Class Library projects with unit test assemblies that target the same framework subset as the library-under-test...
How do I create a unit test assembly for a .NET Portable Class Library?
(I am open to other frameworks that also target PCL, I'm just currently unaware of other solutions besides MSTest that have taken this into account.)