TFS Continuous Build - MSBuild - Running Test fails when search Config files
I'm having a little problem with Running Test on VS TFS 2008 Continuous Build. The problem is that MSTest.exe search config file under "C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE\" path, so the error is:
C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE\MyConfig.config could not be found.
There is a way to specify to MSTest.exe where found config files?
How I can specify that in the TFSBuild.proj?
My TFSBuild.proj file contains these settings:
<PropertyGroup>
<RunTest>true</RunTest>
</PropertyGroup>
and
<ItemGroup>
<MetaDataFile Include="$(BuildProjectFolderPath)/../../MyProj.Complete.vsmdi">
<TestList>Continuous Integration Test</TestList&g开发者_运维百科t;
<RunConfigFile>$(SolutionRoot)\LocalTestRun.testrunconfig</RunConfigFile>
</MetaDataFile>
</ItemGroup>
Thanks a lot!
Use DeploymentItemAttribute in your Unit Tests code. So you can control what files and where are deployed during a test run. For example:
[DeploymentItemAttibute("MyConfig.config", "MyConfig.config")]
[TestMethod]
(...)
This will copy MyConfig.config file to the current directory before a test run. Hope that helps,
精彩评论