将项目从 vs2005 迁移到 vs2010 (MSTest) 后,无法在 UnitTest 中解析类型
我们实际上正在分析如果我们将应用程序从 VS2005 迁移到 VS2010,我们需要做什么。
我所做的:
我在 VS2010 中打开了所有解决方案并让项目进行转换。
目前生产程序集没有获得 .NET Framework 的升级, 它必须以框架2为目标。
单元测试程序集(MSTest)的框架版本由VS2010自动切换到版本4, 到目前为止还好。
问题: 某些单元测试失败,因为它们无法通过 ConfigurationMananger.OpenExeConfiguration(ConfigurationUserLevel.None)
调用访问配置文件。
抛出以下异常:
System.Configuration.ConfigurationErrorsException:发生错误 加载配置文件:未解析成员 X 的类型... System.Runtime.Serialization.SerializationException:类型不是 已为成员 X 解决
成员 X 派生自 GenericIdentity
,并标记为 [Serialized]
。 所有需要的文件(配置、程序集)都是最新的,并正确部署在输出文件夹中。
我尝试将生产程序集的框架版本切换到版本4,但没有帮助。
我找到了这个资源,但它们对我没有帮助。 来自堆栈的帖子
有人知道为什么我会得到所描述的行为吗?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果我将我的身份从 更改为
,
我的所有测试都会变得绿色。
If i change my Identity from
to
all of my tests are gettin green.