Installing MSTest Flat Threading for MTA

I use MSTest in Visual Studio 2010 in a project that needs an apartment streaming model installed in MTA.

I looked online and the items found and verified seem to work only with Visual Studio 2008 and 2005, see http://blogs.msdn.com/b/ploeh/archive/2007/10/21/runningmstestinanmta.aspx .

thanks

+6
visual-studio-2010 mstest mta
source share
1 answer

You are right, most of the information on the Internet is out of date.

In the end I found the Microsoft documentation: How to run unit tests in MTA mode

You need to open the .testsettings file in an XML editor and add the following:

<TestSettings> <Execution> <!-- ... --> <ExecutionThread apartmentState="MTA" /> </Execution> </TestSettings> 

Then restart Visual Studio. It worked for me.

+13
source share

All Articles