NUnit 未运行 Visual Studio 2010 代码 [英] NUnit isn't running Visual Studio 2010 code

查看:38
本文介绍了NUnit 未运行 Visual Studio 2010 代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将 Visual Studio 2010 测试版 dll 加载到 NUnit GUI.我收到一个弹出错误.

I'm trying to load a Visual Studio 2010 beta dll into the NUnit GUI. I get a popup error.

此程序集由比当前加载的运行时更新的运行时构建,无法加载.您可能正在尝试使用比 NUnit 当前运行的版本更高的 CLR 版本加载程序集版本.

This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded. You may be attempting to load an assembly build with a later version of the CLR than the version under which NUnit is currently running.

如何强制可执行文件在 .NET 4 下运行?

How do I force an executable to run under .NET 4?

推荐答案

我已经下载了 NUnit 2.5 源代码并在 VS2010 beta 中打开了 VS2008 解决方案.转换完成后,我打开所有项目并将所有项目的目标框架设置更改为.NET Framework 4.0".然后我构建了没有任何错误的解决方案.我现在可以使用 NUnit GUI 应用程序运行为 .NET 4.0 构建的测试.我没有对这个版本进行详尽的测试,所以可能会有问题,但就我的目的而言,它运行良好.

I've downloaded the NUnit 2.5 source and opened the VS2008 solution in the VS2010 beta. Once the conversion finished I opened all the projects and changed the target framework setting for all the projects to ".NET Framework 4.0". I then built the solution without any errors. I can now use the NUnit GUI app to run tests built for .NET 4.0. I've not done exhaustive testing of this build so there may be problems, but for my purposes it works fine.

更新:没有必要重建 NUnit.我发现如果您将以下内容添加到相关的 NUnit 配置文件中,您可以运行为 .NET 4.0 构建的测试 dll.

Update: It is not necessary to rebuild NUnit. I discovered that if you add the following to the relevant NUnit config file you can run a test dll built for .NET 4.0.

下添加:

Under <configuration> add:

<startup>
  <supportedRuntime version="v4.0.30319" />
</startup>

并在 下添加:

and under <runtime> add:

<loadFromRemoteSources enabled="true" />

这篇关于NUnit 未运行 Visual Studio 2010 代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆