x64 Unit Tests in Visual Studio 2008(Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll)
Are you in the following scenario:
- Your requirement is to compile your managed application as x64
- Your requirement is for your application to consume or communicate with unmanaged COM x64 components
- During development you want to follow a TDD\ agile approach or you want to build a suite of unit tests for your managed app in Visual Studio Team System 2008.
Well if this is you, then you realise you may be in a bit of trouble. The Microsoft.VisualStudio.QualityTools.UnitTestFramework.dll is x86 and there is no x64 version. If your trawling the internet looking for the x64 version you wont find it. Compling your tests as 'Any Cpu' and using it against your x64 component you are consuming will not work as intended. You will receive Bad Format exceptions like below..
Error: System.BadImageFormatException: Attempted to load a 64-bit assembly on a 32-bit platform. Use ReflectionOnlyLoad() instead if trying to load for reflection purposes.
if you complie as x64 and if you dont the unmanaged component cannot be expected to work correctly(And it wont)
This wont cause issues if your system your developing is all managed, but if it isnt then be aware.
The good and bad news is that its fixed in VS2010 and the fix and should be available in the latest CTP.
Comments
Anonymous
March 06, 2010
Thanks! Have been struggling trying to make this work. Cool to know it's fixed in VS2010.Anonymous
November 06, 2012
In VS 2010, I still get the exception.