TFS 持续构建 - MSBuild - 搜索配置文件时运行测试失败

发布于 2024-09-11 09:03:33 字数 862 浏览 2 评论 0原文

我在 VS TFS 2008 Continuous Build 上运行测试时遇到了一些问题。 问题是 MSTest.exe 在下面搜索配置文件 “C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE\”路径,所以错误为:

C:\Program Files (x86)\Microsoft Visual Studio 找不到 9.0\Common7\IDE\MyConfig.config。

有一种方法可以指定 MSTest.exe 在哪里找到配置文件?

我如何在 TFSBuild.proj 中指定它?

我的 TFSBuild.proj 文件包含以下设置:

<PropertyGroup>
  <RunTest>true</RunTest>
</PropertyGroup>

<ItemGroup>
  <MetaDataFile Include="$(BuildProjectFolderPath)/../../MyProj.Complete.vsmdi">
   <TestList>Continuous  Integration Test</TestList>
   <RunConfigFile>$(SolutionRoot)\LocalTestRun.testrunconfig</RunConfigFile>
  </MetaDataFile>
</ItemGroup>

非常感谢

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>
   <RunConfigFile>$(SolutionRoot)\LocalTestRun.testrunconfig</RunConfigFile>
  </MetaDataFile>
</ItemGroup>

Thanks a lot!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

有深☉意 2024-09-18 09:03:34

使用 DeploymentItemAttribute 在您的单元测试代码中。因此,您可以控制测试运行期间部署哪些文件以及部署在何处。例如:

[DeploymentItemAttibute("MyConfig.config", "MyConfig.config")]
[TestMethod]
(...)

这将在测试运行之前将 MyConfig.config 文件复制到当前目录。
希望有帮助,

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,

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文