Search code examples
unit-testingmsbuildmstest

MSTest exception: Unit Test Adapter threw exception: Type is not resolved for member


In my project I write tests using Microsoft's unit testing framework. All of my tests pass when I run them from Visual Studio but when I run the tests from MSBuild all of the tests fail with the following erorr message:

Unit Test Adapter threw exception: Type is not resolved for member SomeType,SomeAssembly Version=assemblyVersion, Culture=neutral, PublicKeyToken=..

The assembly not found is a 3rd party assembly referenced by all of the projects.

The build script is used by TFS so I've aded the following lines:

<RunTest>true</RunTest>

<ItemGroup>
    <MetaDataFile Include="$(BuildProjectFolderPath)myproject.vsmdi">
        <TestList>CI_Tests</TestList>
    </MetaDataFile>
</ItemGroup>

I've found the this post that shows a solution to this issue but unfortunatly I cannot chnage the files on the TFS server.

Help!


Solution

  • The first thing to check would be if this assembly is copied to the folder from which msbuild runs the tests. It might be the case that you have a copy in your bin/Debug folder because of some historic reasons, but the dependency is not set up properly in the project.