将项目从 vs2005 迁移到 vs2010 (MSTest) 后,无法在 UnitTest 中解析类型 [英] Type cant be resolve in UnitTest after migrating Project from vs2005 to vs2010 (MSTest)

本文介绍了将项目从 vs2005 迁移到 vs2010 (MSTest) 后,无法在 UnitTest 中解析类型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们实际上是在分析如果我们将应用程序从 VS2005 迁移到 VS2010,我们必须做些什么.

We are actually analyzing what we have to do if we migrate our application from VS2005 up to VS2010.

我做了什么:

我在VS2010中打开了所有解决方案,让convert vs项目.

I opened all solutions in VS2010 and let convert vs the projects.

目前生产程序集没有升级 .NET Framework,它必须针对框架 2.

At the moment the production assemblies dont get an upgrade of the .NET Framework, it has to target the framework 2.

框架版本单元测试程序集(MSTest)被VS2010自动切换到版本4,到目前为止还可以.

The framework version of the unit test assemblies (MSTest) is switched to the version 4 by VS2010 automatically, thats ok so far.

问题:一些单元测试失败,因为它们无法通过 ConfigurationMananger.OpenExeConfiguration(ConfigurationUserLevel.None) 调用访问配置文件.

The Problem: Some unit tests are failing cause they can't access a config file through the ConfigurationMananger.OpenExeConfiguration(ConfigurationUserLevel.None) call.

抛出以下异常:

System.Configuration.ConfigurationErrorsException:发生错误加载配置文件:类型未解析成员 X ...System.Runtime.Serialization.SerializationException:类型不是已为成员 X 解决

System.Configuration.ConfigurationErrorsException: An error occurred loading a configuration file: Type is not resolved for member X ... System.Runtime.Serialization.SerializationException: Type is not resolved for member X

成员 X 派生自 GenericIdentity 并标记为 [Serializable].所有需要的文件(配置、程序集)都是最新的,并且正确部署在输出文件夹中.

The member X is derived from GenericIdentity and is marked as [Serializable]. All needed files (configuration, assemblies) are up to date and are correctly deployed in the output folder.

我尝试将生产程序集的框架版本切换到版本 4,但没有帮助.

I tried to switch the framework version of the production assemblies to version 4, but it didn't help.

我找到了这个资源,但他们没有帮助我.从堆栈发布

I found this ressources, but they dont helped me. post from stack

有人知道我为什么会得到所描述的行为吗?

Anybody has an idea why i get the described behavior?

推荐答案

如果我改变了我的身份

public MyIdentity : GenericIdentity
{ }

public MyIdentity : MarshalByRefObject, IIdentity
{ }

我所有的测试都是绿色的.

all of my tests are gettin green.

这篇关于将项目从 vs2005 迁移到 vs2010 (MSTest) 后,无法在 UnitTest 中解析类型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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