I'm getting an unusual error when building a Visual Studio 2010 solution via MSBuilt using MSTest. If I enter a file name (e.g. "TestResults.trx") in the Build Runner | MSBuild | MSTest Settings | Results file setting, most of my integration tests fail with the following error:
System.Data.SqlClient.SqlException: System.Data.SqlClient.SqlException: Cannot open database "NatureShopTest" requested by the login. The login failed.
Login failed for user 'NT AUTHORITY\SYSTEM'..
If I clear the "Results file" field then the unit tests pass???
This is strange for two reasons. Firstly I wouldn't expect that field to alter the security context that TeamCity used to MSTest. Secondly, The System account has sysadmin access control to both the master database and the database that is being used to run various tests.
Anyone have any idea what could be going on here?