MSTest.exe does not copy all the necessary project dlls?

I am trying to run MSTest.exe, and it looks like testcontainer is not reading correctly; while my tests all run successfully in all configuration environments in Visual Studio.

command used by me:

"C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\MSTest.exe" /nologo /usestderr /testSettings:"C:\temp\MyProject\Sources\MyProject\Local.testsettings" /searchpathroot:"C:\temp\MyProject\Binaries" /resultsfileroot:"C:\temp\MyProject\TestResults" /testcontainer:"C:\temp\MyProject\Binaries\MyProject.Services.Server.UnitTests.dll" 

The project link in the testcontainer project is as follows:

 <ItemGroup> <ProjectReference Include="..\..\Services\MyProject.Services.Server\MyProject.Services.Server.csproj"> <Project>{92EC1999-CC0C-47DD-A4D6-17C3B1233C50}</Project> <Name>MyProject.Services.Server</Name> </ProjectReference> <ProjectReference Include="..\..\SvcConfiguration\MyProject.ServiceConfiguration.Interfaces\MyProject.ServiceConfiguration.Interfaces.csproj"> <Project>{8E2E7BA9-75DB-458E-A184-AC1030EAD581}</Project> <Name>MyProject.ServiceConfiguration.Interfaces</Name> </ProjectReference> <ProjectReference Include="..\..\SvcConfiguration\MyProject.ServiceConfiguration.Services\MyProject.ServiceConfiguration.Services.csproj"> <Project>{39514766-23A8-45DB-96EA-B6B4D9C8B086}</Project> <Name>MyProject.ServiceConfiguration.Services</Name> </ProjectReference> </ItemGroup> 

Neither the ServiceConfiguration.Interfaces or ServiceConfiguration.Services DLLs fit into the Out folder in TestResults.

The project GUIDs match between links and link projects.

Is there something that I am missing on the command line?

+8
command-line mstest
source share
3 answers

mstest.exe will not link to all links referenced by the dll: http://www.dotnetthoughts.net/2011/11/22/mstest-exe-does-not-deploy-all-items/

+6
source share

You can specify exactly which files are copied to the test directory using the test parameters file . You can create several test setup files in Visual Studio, so you can use them to work with VS, another to work with MSTest, another to build a CI server, etc. See here for more information: Create test settings to run automated tests from Visual Studio

Use the /testsettings:<filename> parameter to specify it on the command line.

At first it seems that people embarrass people that by default MSTest "current directory" is not the start directory of MSTest, but the "Out" folder of the test results.

As mentioned earlier, MSTest incorrectly displays all used assemblies; if you do not have a direct link, it will not copy the assembly. However, Visual Studio has similar behavior in its assembly, so many people work around this, adding links to dummy code - a terrible solution - I do not recommend it.

However, native DLLs are even more problematic, and I found that they explicitly copy them in the test configuration (test settings), as well as for managed assemblies.

+4
source share

Regardless of whether it goes to Out or the build area, it depends on various factors, however, in those situations when it still does not work, you can use the “hack” DeploymentItem or configure the runsettings file.

Try to find the answer: stack overflow

+1
source share

All Articles