我正在尝试使用 NUnit 和标准控制台(GUI 或非 GUI)运行器测试 Windows Phone 7.1 类库。
在我的问题之后,我在下面找到了这个: http ://dotneteers.net/blogs/vbandi/archive/2012/08/08/using-nunit-to-test-windows-phone-7-applications-part- 1.aspx
所以我几乎可以肯定这是我自己的一个愚蠢的问题。
每次我尝试加载我的程序集测试时,我都会收到此错误:
System.TypeLoadException:无法从程序集'mscorlib,版本 = 2.0.0.0,文化 = 中性,PublicKeyToken = b77a5c561934e089' 加载类型'System.Runtime.Versioning.TargetFrameworkAttribute'。
如需更多信息,请使用异常详细信息菜单项。
* 这里是“详细信息” *
System.TypeLoadException...
服务器堆栈跟踪: en System.ModuleHandle.ResolveType(Int32 typeToken, RuntimeTypeHandle* typeInstArgs, Int32 typeInstCount, RuntimeTypeHandle* methodInstArgs, Int32 methodInstCount) en System.ModuleHandle.ResolveTypeHandle(Int32 typeToken, RuntimeTypeHandle[] typeInstantiationContext, RuntimeTypeHandle[] methodInstantiationContext) .Reflection.Module.ResolveType(Int32 metadataToken, Type[] genericTypeArguments, Type[] genericMethodArguments) en System.Reflection.CustomAttribute.FilterCustomAttributeRecord(CustomAttributeRecord caRecord, MetadataImport scope, Assembly& lastAptcaOkAssembly, Module decoratedModule, MetadataToken decoratedToken, RuntimeType attributeFilterType, Boolean mustBeInheritable, Object[] 属性,IList derivedAttributes,RuntimeType& attributeType,RuntimeMethodHandle& ctor, Boolean& ctorHasParameters, Boolean& isVarArg) en System.Reflection.CustomAttribute.GetCustomAttributes(Module decoratedModule, Int32 DecorationMetadataToken, Int32 pcaCount, RuntimeType attributeFilterType, Boolean mustBeInheritable, IList derivedAttributes) en System.Reflection.CustomAttribute.GetCustomAttributes(Assembly assembly, RuntimeType caType ) en System.Reflection.Assembly.GetCustomAttributes(Type attributeType, Boolean inherit) en NUnit.Core.ActionsHelper.GetActionsFromAttributeProvider(ICustomAttributeProvider attributeProvider) en NUnit.Core.TestAssembly..ctor(Assembly assembly, String path) en NUnit.Core.Builders .TestAssemblyBuilder.BuildTestAssembly(Assembly assembly, String assemblyName, IList fixtures, Boolean autoSuites)ctorHasParameters, Boolean& isVarArg) en System.Reflection.CustomAttribute.GetCustomAttributes(Module decoratedModule, Int32 decoratedMetadataToken, Int32 pcaCount, RuntimeType attributeFilterType, Boolean mustBeInheritable, IList derivedAttributes) en System.Reflection.CustomAttribute.GetCustomAttributes(Assembly assembly, RuntimeType caType) en System. Reflection.Assembly.GetCustomAttributes(Type attributeType, Boolean inherit) en NUnit.Core.ActionsHelper.GetActionsFromAttributeProvider(ICustomAttributeProvider attributeProvider) en NUnit.Core.TestAssembly..ctor(Assembly assembly, String path) en NUnit.Core.Builders.TestAssemblyBuilder.BuildTestAssembly (程序集程序集、字符串程序集名称、IList 固定装置、布尔自动套件)ctorHasParameters, Boolean& isVarArg) en System.Reflection.CustomAttribute.GetCustomAttributes(Module decoratedModule, Int32 decoratedMetadataToken, Int32 pcaCount, RuntimeType attributeFilterType, Boolean mustBeInheritable, IList derivedAttributes) en System.Reflection.CustomAttribute.GetCustomAttributes(Assembly assembly, RuntimeType caType) en System. Reflection.Assembly.GetCustomAttributes(Type attributeType, Boolean inherit) en NUnit.Core.ActionsHelper.GetActionsFromAttributeProvider(ICustomAttributeProvider attributeProvider) en NUnit.Core.TestAssembly..ctor(Assembly assembly, String path) en NUnit.Core.Builders.TestAssemblyBuilder.BuildTestAssembly (程序集程序集、字符串程序集名称、IList 固定装置、布尔自动套件)CustomAttribute.GetCustomAttributes(Module decoratedModule,Int32 decoratedMetadataToken,Int32 pcaCount,RuntimeType attributeFilterType,Boolean mustBeInheritable,IList derivedAttributes) en System.Reflection.CustomAttribute.GetCustomAttributes(Assembly 程序集,RuntimeType caType) en System.Reflection.Assembly.GetCustomAttributes(Type attributeType,Boolean inherit) en NUnit.Core.ActionsHelper.GetActionsFromAttributeProvider(ICustomAttributeProvider attributeProvider) en NUnit.Core.TestAssembly..ctor(Assembly assembly, String path) en NUnit.Core.Builders.TestAssemblyBuilder.BuildTestAssembly(Assembly assembly, String assemblyName, IList fixtures,布尔自动套件)CustomAttribute.GetCustomAttributes(Module decoratedModule,Int32 decoratedMetadataToken,Int32 pcaCount,RuntimeType attributeFilterType,Boolean mustBeInheritable,IList derivedAttributes) en System.Reflection.CustomAttribute.GetCustomAttributes(Assembly 程序集,RuntimeType caType) en System.Reflection.Assembly.GetCustomAttributes(Type attributeType,Boolean inherit) en NUnit.Core.ActionsHelper.GetActionsFromAttributeProvider(ICustomAttributeProvider attributeProvider) en NUnit.Core.TestAssembly..ctor(Assembly assembly, String path) en NUnit.Core.Builders.TestAssemblyBuilder.BuildTestAssembly(Assembly assembly, String assemblyName, IList fixtures,布尔自动套件)Boolean mustBeInheritable, IList derivedAttributes) en System.Reflection.CustomAttribute.GetCustomAttributes(Assembly assembly, RuntimeType caType) en System.Reflection.Assembly.GetCustomAttributes(Type attributeType, Boolean inherit) en NUnit.Core.ActionsHelper.GetActionsFromAttributeProvider(ICustomAttributeProvider attributeProvider) en NUnit .Core.TestAssembly..ctor(Assembly assembly, String path) en NUnit.Core.Builders.TestAssemblyBuilder.BuildTestAssembly(Assembly assembly, String assemblyName, IList fixtures, Boolean autoSuites)Boolean mustBeInheritable, IList derivedAttributes) en System.Reflection.CustomAttribute.GetCustomAttributes(Assembly assembly, RuntimeType caType) en System.Reflection.Assembly.GetCustomAttributes(Type attributeType, Boolean inherit) en NUnit.Core.ActionsHelper.GetActionsFromAttributeProvider(ICustomAttributeProvider attributeProvider) en NUnit .Core.TestAssembly..ctor(Assembly assembly, String path) en NUnit.Core.Builders.TestAssemblyBuilder.BuildTestAssembly(Assembly assembly, String assemblyName, IList fixtures, Boolean autoSuites)ActionsHelper.GetActionsFromAttributeProvider(ICustomAttributeProvider attributeProvider) en NUnit.Core.TestAssembly..ctor(Assembly assembly, String path) en NUnit.Core.Builders.TestAssemblyBuilder.BuildTestAssembly(Assembly assembly, String assemblyName, IList fixtures, Boolean autoSuites)ActionsHelper.GetActionsFromAttributeProvider(ICustomAttributeProvider attributeProvider) en NUnit.Core.TestAssembly..ctor(Assembly assembly, String path) en NUnit.Core.Builders.TestAssemblyBuilder.BuildTestAssembly(Assembly assembly, String assemblyName, IList fixtures, Boolean autoSuites)
en NUnit.Core.Builders.TestAssemblyBuilder.Build(String assemblyName, Boolean autoSuites) en NUnit.Core.Builders.TestAssemblyBuilder.Build(String assemblyName, String testName, Boolean autoSuites) en NUnit.Core.TestSuiteBuilder.BuildSingleAssembly(TestPackage package)
en NUnit.Core.TestSuiteBuilder.Build(TestPackage package) en NUnit.Core.SimpleTestRunner.Load(TestPackage package) en NUnit.Core.ProxyTestRunner.Load(TestPackage package) en NUnit.Core.ProxyTestRunner.Load(TestPackage package) en NUnit .Core.RemoteTestRunner.Load(TestPackage package) en System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr md, Object[] args, Object server, Int32 methodPtr, Boolean fExecuteInContext, Object[]& outArgs) en System.Runtime .Remoting.Messaging.StackBuilderSink.PrivateProcessMessage(RuntimeMethodHandle md, Object[] args, Object server, Int32 methodPtr, Boolean fExecuteInContext, Object[]& outArgs) en System.Runtime.Remoting.Messaging.StackBuilderSink.SyncProcessMessage(IMessage msg, Int32 methodPtr , 布尔 fExecuteInContext)在 [0] 处重新抛出异常: en System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg) en System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type) en NUnit.Core。 TestRunner.Load(TestPackage package) en NUnit.Util.TestDomain.Load(TestPackage package) en NUnit.Util.TestLoader.LoadTest(String testName)
有人知道我找不到什么问题吗?