单元测试因“构建失败”而失败在会话窗口中,没有任何消息提供 Visual Studios 2010 中失败的原因
我最近在本地计算机上安装了 VS 2010,但似乎无法让 Resharper 5.1 和单元测试正常工作。 每当我尝试运行单元测试时,我都会收到“构建失败”,测试图标保持灰色,但输出窗口中没有信息,也没有明显的原因。
在进行 nant 构建时,单元测试运行得非常好。
在 VS 2008 上运行代码的先前分支不会出现同样的问题。
有什么想法吗?
I had recently installed VS 2010 on my local machine, and cannot seem to get Resharper 5.1 and the unit tests to work correctly.
Whenever I try and run Unit tests I get a "Build failed" with the test icon remaining gray, but with no info in the output window and no discernible reason why.
The Unit Tests run perfectly fine when doing a nant build.
Running a previous branch of the code on VS 2008 does not have this same issue as a result.
Any ideas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
检查您的构建配置。如果您使用的构建配置设置为不构建测试项目(例如发布配置),则 Resharper 测试运行程序将以这种方式失败。输出看起来像是一个完美成功的构建,但是如果您检查输出,您会发现您的测试不在其中。
此问题的另一个症状是,如果您将测试运行程序设置为不按照上面的建议进行构建,那么下次您尝试运行测试时,它将在测试运行程序中被划掉。
构建配置可以在 Visual Studio 中的“构建”->“配置管理器”中找到。
Check your build configuration. If you're using a build configuration that is set to not build your test projects (like your release configuration) then the Resharper test runner will fail this way. The output looks like a perfectly successful build but if you inspect the output you'll find your tests are not in it.
Another symptom of this issue is if you set the test runner to not build as suggested above, next time you attempt to run the test it will be crossed out in the test runner.
Build configurations can be found in Build->Configuration Manager in Visual Studio.
如果您在单元测试会话窗口中将构建设置更改为“从不构建”,则它可以正常工作(前提是您使用 Visual Studio 预构建 dll)。这似乎是 Resharper 的错误。
If you change the build settings to 'never build' in the unit test sessions window, it works ok (providing you pre-build the dll using visual studio). It appears to be a Resharper bug.
就我而言,这确实解决了问题:
http://www.shirmanov.com/2011 /07/project-has-not-been-built-resharper.html
我在解决方案配置中将 UnitTests 设置为“不构建”。
上面提到的文章非常详细地展示了这一点。
In my case this did solve the issue:
http://www.shirmanov.com/2011/07/project-has-not-been-built-resharper.html
I had the UnitTests set "to not build" in my solution configuration.
The above mentioned article shows this very detailed.
就我而言,我缺少一个未添加到项目中的 DLL。我添加了它,清理并构建,一切都很好。
In my case I was missing a DLL that was not added to the project. I added it, cleaned and build and everything was okay.
在 Visual Studio 配置管理器中验证您的测试项目是否已标记为要生成。
Verify in Visual Studio Configuration Manager that your test projects are marked to be build.