views:

282

answers:

2

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!

+1  A: 

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.

Grzenio
nope, the dll is copied...
Dror Helper
is it the correct version? and the dependencies of this dll?
Grzenio
I think the version is correct and the only dependencies this dll has is .NET BCL
Dror Helper
+1  A: 

Check out this blog post about it: http://thisthattechnology.blogspot.com/2009/03/vsts-unit-test-type-is-not-resolved.html

Dan
Have you read the question? "I've found the this post that shows a solution to this issue but unfortunatly I cannot chnage the files on the TFS server."
Dror Helper