是否可以在运行测试之前构建 VS 2010

发布于 2024-10-05 09:49:36 字数 369 浏览 0 评论 0原文

我想在 Visual Studio 2010 中测试一个类库项目。我在同一解决方案中创建了一个单独的测试项目来测试它。测试项目引用类库项目。我创建了一些测试并运行它们,但它们失败了,这是预期的。然而,当我修复类库并再次运行测试时,它仍然失败。这是因为 Class Libary 项目尚未重建。

有没有办法让 Visual Studio 2010 在运行测试之前自动构建测试项目及其所有依赖项?

编辑:

我检查过的一些事情:

  1. 我检查过参考是项目参考。
  2. 我已经检查过测试项目位于构建顺序的最后。

还是没有喜悦。为了以防万一,我使用工具栏上的“运行解决方案中的所有测试(Ctrl+R,A)”按钮来运行测试。

I have a Class Library project in Visual Studio 2010 that I want to test. I have created a seperate Test project in the same solution to test it. The Test project references the Class Library project. I created some tests ran them and they failed which was expected. However when I fixed the Class Library and ran the tests again it still failed. This was because the Class Libary project had not been rebuilt.

Is there some way to get Visual Studio 2010 to automatically build the Test project and all its dependancies before running the tests?

EDIT:

Some things I have checked:

  1. I've checked the reference is a project reference.
  2. I've checked the Test project is last in the build order.

Still no joy. In case it makes any difference I am running the tests using the "Run All Tests in Solution (Ctrl+R, A)" button on the tool bar.

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

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

发布评论

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

评论(2

痴情换悲伤 2024-10-12 09:49:36

右键单击您的测试项目,选择项目构建顺序并将类库项目设置为在测试项目之前构建,这应该有效;-)

Right click on your test project, select Project Build Order and set your class library project to build before your test project, this should works ;-)

妄断弥空 2024-10-12 09:49:36

好的,这就是我解决此问题的方法:

  1. 选择“测试”->“编辑测试设置”->“本地”菜单项。
  2. 在出现的对话框中选择“部署”。
  3. 检查“启用部署”设置。
  4. 应用并关闭对话框。

Ok, Here is what I did to fix this:

  1. Select the Test->Edit Test Settings->Local menu item.
  2. In the resulting dialog select Deployment.
  3. Check the 'Enable deployment' setting.
  4. Apply and Close the dialog.
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文