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

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

问题描述

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

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


此程序集是由运行时比当前加载的运行时更新的,不能加载的。您可能正在尝试使用更高版本的CLR加载组件构建,而不是NUnit当前正在运行的版本。

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源代码并打开了VS2008解决方案在VS2010测试版。完成转换后,我打开所有项目,并将所有项目的目标框架设置更改为.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.

在< configuration> add: p>

Under <configuration> add:

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

和<运行时>添加:

and under <runtime> add:

<loadFromRemoteSources enabled="true" />

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

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