Running Pex with .NET 3.5 projects

为君一笑 提交于 2019-12-13 07:40:22

问题


I'm currently trying to use Pex and Moles with a SharePoint 2010 solution that's written in .NET 3.5. When adding a test project (by using Pex -> Create parameterized tests) everything seems to work OK. However, when I try to compile I end up with a massive list of errors (missing namespaces and such) and warnings regarding referenced assemblies not being able to be resolved (such as System.Web which under .NET 4 is no single DLL anymore).

This is due to the projects under test is .NET 3.5 and the Pex test project is .NET 4.0 as far as I understand it, but is it possible to make this combination work at all?


回答1:


If you change the project Target Framework to ".Net Framework 3.5" and then open the project AssemblyInfo.cs file and comment out the following line:

[assembly: SecurityRules(SecurityRuleSet.Level1)]

the project should build. How this affects PEX and its "Explorations" I am not sure. I hope this gets you a little further down the road.




回答2:


The answer is here: http://msdn.microsoft.com/en-us/library/system.reflection.assembly.securityruleset.aspx

"By default, assemblies that you compile with the .NET Framework version 4 have level 2 transparency, although you can explicitly make them level 1 instead.Assemblies that were compiled with earlier versions of the .NET Framework have level 1 transparency"



来源:https://stackoverflow.com/questions/6816357/running-pex-with-net-3-5-projects

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