Benoit Martin
Benoit Martin

Reputation: 3303

Referenced projects' assemblies are not deployed to test folder with VS 2012

I recently switched to vs2012 and I can't get my tests to run because the assemblies for the referenced projects are not being deployed to the test folder in TestResults. I am using the same Local.testsettings file which works fine in VS2010. I have other dependencies added in the Deployment tab of the testsettings file and those get deployed correctly. The assembly for my tests is being deployed also so it's just the project dependencies that do not get deployed.

I tried creating a new Local.testsettings file using vs2012 thinking there may be something slightly different between the 2 versions but that did not solve my problem.

Anybody aware of something that may have changed with VS2012 in the way they deploy dependent assemblies?

Thank you

Upvotes: 3

Views: 341

Answers (1)

Borislav T
Borislav T

Reputation: 618

There are a couple of related answered questions about this issue: Problems with DeploymentItem attribute C# DeploymentItem fails to copy file for MSTest unit test

However, in VS 2012 MS did changes to MSTest (unfortunately I cannot find URLs to the couple of blog posts that they did about these changes - they were mentioned a bit in-between the other new stuff they did) so now when you have an assembly as a deployment item - either from a test class, test method or a TestSettings file, it might still be left out!

The reason seems to be that mstest looks for class instantiation from referenced assemblies. If there is none, the assembly will not get copied. We had this problem with tests that were using a framework which in turn used NewtonSoft.JSON. We had to create a dummy test class and method that instantiated any class from the NewtonSoft.JSON lib so that its DLL would be copied.

Give it a go and fingers crossed that it works.

Upvotes: 1

Related Questions