将项目从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中打开了所有解决方案,然后对项目进行转换.

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?

推荐答案

如果我从以下位置更改身份

If i change my Identity from

public MyIdentity : GenericIdentity
{ }

public MyIdentity : MarshalByRefObject, IIdentity
{ }

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

all of my tests are gettin green.

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

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