Type cant be resolve in UnitTest after migrating Project from vs2005 to vs2010 (MSTest)

一笑奈何 提交于 2019-12-20 03:06:12

问题


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


What i have done:

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

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

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


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

The following exception is thrown:

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

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.

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?


回答1:


If i change my Identity from

public MyIdentity : GenericIdentity
{ }

to

public MyIdentity : MarshalByRefObject, IIdentity
{ }

all of my tests are gettin green.



来源:https://stackoverflow.com/questions/7539557/type-cant-be-resolve-in-unittest-after-migrating-project-from-vs2005-to-vs2010

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!