asp.net-mvc-3 – DotNetOpenAuth.Asp在MVC4应用程序单元测试中
发布时间:2020-12-15 20:28:42 所属栏目:asp.Net 来源:网络整理
导读:我的项目中面临着非常奇怪的错误.我安装了DotnetOpenAuth.Aspnet和Microsoft.AspNet.WebPages.OAuth库nuget包.当我运行项目没有问题.但是当我编写控制器的测试时,它会抛出如下的异常. 测试方法MvcApplication2.Tests.ControllerTest.should_return_not_empty
我的项目中面临着非常奇怪的错误.我安装了DotnetOpenAuth.Aspnet和Microsoft.AspNet.WebPages.OAuth库nuget包.当我运行项目没有问题.但是当我编写控制器的测试时,它会抛出如下的异常.
测试方法MvcApplication2.Tests.ControllerTest.should_return_not_empty_content抛出异常: System.IO.FileLoadException: Could not load file or assembly 'DotNetOpenAuth.AspNet,Version=4.0.0.0,Culture=neutral,PublicKeyToken=2780ccd10d57b246' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040) 另一个奇怪的一点是如果我在VS 2010中设置一个项目,因为MVC3应用程序和测试正在传递.没有失败.但是当我在VS2012中完成相同的设置时,它发出与上述相同的错误. 您可以在以下行中找到所有项目和样本测试.它只是一个应用程序一个测试项目.很容易阅读 此外,我在这里添加了一个示例代码,用于控制器和失败的测试. 用于代码预览的pastebin链接为http://pastebin.com/1PCpq3hW 任何帮助将不胜感激. Vs2010和2012年projects不成功 详细的日志结果如下所示 *** Assembly Binder Log Entry (13.12.2012 @ 22:27:31) *** The operation failed. Bind result: hr = 0x80131040. No description available. Assembly manager loaded from: C:WindowsMicrosoft.NETFrameworkv4.0.30319clr.dll Running under executable C:Program Files (x86)JetBrainsReSharperv7.0BinJetBrains.ReSharper.TaskRunner.CLR4.exe --- A detailed error log follows. === bind state information === LOG: User = DEVELOPER-PCDEVELOPER LOG: DisplayName = DotNetOpenAuth.AspNet,PublicKeyToken=2780ccd10d57b246 (Fully-specified) LOG: Appbase = file:///D:/Development/Coachius/CoachiusWeb.Tests/bin/Debug LOG: Initial PrivatePath = NULL LOG: Dynamic Base = NULL LOG: Cache Base = NULL LOG: AppName = NULL Calling assembly : CoachiusWeb,Version=1.0.0.0,PublicKeyToken=null. === LOG: This bind starts in default load context. LOG: Using application configuration file: D:DevelopmentCoachiusCoachiusWeb.TestsbinDebugCoachiusWeb.Tests.dll.config LOG: Using host configuration file: LOG: Using machine configuration file from C:WindowsMicrosoft.NETFrameworkv4.0.30319configmachine.config. LOG: Post-policy reference: DotNetOpenAuth.AspNet,PublicKeyToken=2780ccd10d57b246 LOG: GAC Lookup was unsuccessful. LOG: Attempting download of new URL file:///D:/Development/Coachius/CoachiusWeb.Tests/bin/Debug/DotNetOpenAuth.AspNet.DLL. LOG: Assembly download was successful. Attempting setup of file: D:DevelopmentCoachiusCoachiusWeb.TestsbinDebugDotNetOpenAuth.AspNet.dll LOG: Entering run-from-source setup phase. LOG: Assembly Name is: DotNetOpenAuth.AspNet,Version=4.1.0.0,PublicKeyToken=2780ccd10d57b246 WRN: Comparing the assembly name resulted in the mismatch: Minor Version ERR: The assembly reference did not match the assembly definition found. ERR: Run-from-source setup phase failed with hr = 0x80131040. ERR: Failed to complete setup of assembly (hr = 0x80131040). Probing terminated. 解决方法
我已经解决了
<configuration> <runtime> <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> <dependentAssembly> <assemblyIdentity name="DotNetOpenAuth.AspNet" publicKeyToken="2780ccd10d57b246" culture="neutral" /> <bindingRedirect oldVersion="0.0.0.0-4.3.0.0" newVersion="4.3.0.0" /> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="DotNetOpenAuth.Core" publicKeyToken="2780ccd10d57b246" culture="neutral" /> <bindingRedirect oldVersion="0.0.0.0-4.3.0.0" newVersion="4.3.0.0" /> </dependentAssembly> <dependentAssembly> <assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e35" culture="neutral" /> <bindingRedirect oldVersion="0.0.0.0-1.5.2.14234" newVersion="1.5.2.14234" /> </dependentAssembly> </assemblyBinding> </runtime> </configuration> (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
相关内容
- .NET Core多平台项目模板eShopOnContainers编译手记
- 为什么这个ASP.Net Code-behind中的if语句不起作用?
- asp.net-mvc – Html.TextBoxFor在POST操作中不显示更新的值
- ASP.Net Checkbox值在回发错误?
- asp.net-mvc – 为什么ASP.NET MVC 4与IList for editor不能
- asp.net-mvc – 使用模型更改更新scaffolded控制器和视图
- 数组 – 带有int数组参数的EF ExecuteSqlCommand
- asp.net-mvc – 将参数传递给Azure Active Directory身份验
- asp.net-mvc – ASP.NET MVC:仅由其他操作调用的Action
- asp.net – StyleCop vs ReSharper和一般编码风格的问题
推荐文章
站长推荐
- asp.net – 创建适合任何屏幕分辨率的母版页
- asp.net-mvc-2 – 仅在运行调试器时出现Antiforg
- 将数据从asp.net-mvc传递到javascript的最佳做法
- 在asp.net中动态构建SiteMapPath
- asp.net-mvc – asp.net mvc多语言urls /路由
- asp.net-mvc – mvc 3 session和authorizeAttrib
- jqGrid,ASP.NET,JSON让我发疯.请帮忙
- asp.net-core – AuthorizationHandler和数据库依
- 实体框架 – 单个或多个存储库类?
- asp.net-mvc – 如何使更多MapHttpRoutes为MVC 4
热点阅读