简体   繁体   English

无法加载文件或程序集'System.Web.Mvc'或其依赖项之一。 2个项目。 一次只能工作一个

[英]Could not load file or assembly 'System.Web.Mvc' or one of its dependencies. 2 projects. Only one will work at a time

So i've got 2 website projects(among many other test/dll projects) in my solution. 因此,我的解决方案中有2个网站项目(以及许多其他测试/ dll项目)。

Project A - CMS - Standard Web Project(with some Web API integration) Project B - Display Site - MVC 5. 项目A-CMS-标准Web项目(具有某些Web API集成)项目B-显示站点-MVC 5。

I build Project A, and run it. 我构建项目A,然后运行它。 It works, with no unexpected bugs. 它可以正常工作,没有意外错误。 I then build Project B. Project B works, again with no unexpected bugs. 然后,我构建了项目B。项目B正常运行,再次没有意外的错误。

I go back to view something on Project A, and i get the following error at run-time. 我返回查看Project A上的内容,并在运行时收到以下错误。

Could not load file or assembly 'System.Web.Mvc' or one of its dependencies. 无法加载文件或程序集'System.Web.Mvc'或其依赖项之一。 The located assembly's manifest definition does not match the assembly reference. 找到的程序集的清单定义与程序集引用不匹配。 (Exception from HRESULT: 0x80131040) (来自HRESULT的异常:0x80131040)

Description: An unhandled exception occurred during the execution of the current web request. 说明:执行当前Web请求期间发生未处理的异常。 Please review the stack trace for more information about the error and where it originated in the code. 请查看堆栈跟踪,以获取有关错误及其在代码中起源的更多信息。

Exception Details: System.IO.FileLoadException: Could not load file or assembly 'System.Web.Mvc' or one of its dependencies. 异常详细信息: System.IO.FileLoadException:无法加载文件或程序集'System.Web.Mvc'或其依赖项之一。 The located assembly's manifest definition does not match the assembly reference. 找到的程序集的清单定义与程序集引用不匹配。 (Exception from HRESULT: 0x80131040) (来自HRESULT的异常:0x80131040)

[FileLoadException: Could not load file or assembly 'System.Web.Mvc' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)]
[FileLoadException: Could not load file or assembly 'System.Web.Mvc, Version=5.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)]
System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) +0
System.Reflection.RuntimeAssembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) +34
System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) +152
System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean forIntrospection) +77
System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection) +16
System.Reflection.Assembly.Load(String assemblyString) +28
System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +38

[ConfigurationErrorsException: Could not load file or assembly 'System.Web.Mvc, Version=5.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)]
System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +752
System.Web.Configuration.CompilationSection.LoadAllAssembliesFromAppDomainBinDirectory() +218
System.Web.Configuration.CompilationSection.LoadAssembly(AssemblyInfo ai) +130
System.Web.Compilation.BuildManager.GetReferencedAssemblies(CompilationSection compConfig) +170
System.Web.Compilation.BuildManager.GetPreStartInitMethodsFromReferencedAssemblies() +91
System.Web.Compilation.BuildManager.CallPreStartInitMethods(String preStartInitListPath, Boolean& isRefAssemblyLoaded) +285
System.Web.Compilation.BuildManager.ExecutePreAppStart() +153
System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception appDomainCreationException) +516

[HttpException (0x80004005): Could not load file or assembly 'System.Web.Mvc, Version=5.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)]
System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +9915300
System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +101
System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +254

I have to then build Project A to get it to load at run-time. 然后,我必须构建Project A以使其在运行时加载。 it works, but then Project B has the same problem. 它可以工作,但是Project B也有同样的问题。

I've gone into the /bin/ folder of the Projects and observed something wierd. 我进入了Projects的/ bin /文件夹,发现有些奇怪。 Say im looking at the /bin for Project A 说我正在查看项目A的/ bin

If i build Project A, the System.Web.Mvc.dll file has a version of 5.1.20129.0 If i build Project B, the same DLL file changes its version back a step. 如果我生成Project A,则System.Web.Mvc.dll文件的版本为5.1.20129.0。如果我生成Project B,则相同的DLL文件将其版本后退一步。 To 5.0.11001.0 至5.0.11001.0

Using this information, i can understand why the error is firing, as the version it thinks it is is a higher version than the one that is there. 使用此信息,我可以理解为什么会引发该错误,因为它认为该版本比那里的版本高。

Also, it isn't getting synced with our Git Repository, as no other developers are getting the problem. 而且,它没有与我们的Git存储库同步,因为没有其他开发人员遇到此问题。

Anyone got any ideas as to how this began to happen? 任何人都知道这是如何开始的吗? And possibly how i can fix it? 可能我该如何解决?

Ta

Right click on solutions and go to Start up project under Common properties, Chose multiple startup project, select both of your project. 右键单击解决方案,然后转到“公共属性”下的“启动项目”,选择“多个启动项目”,选择两个项目。 This will run both project and fix your problem. 这将同时运行项目并解决您的问题。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 无法加载文件或程序集“System.Web.Mvc”或其依赖项之一。 定位的程序集的清单定义与程序集不匹配 - Could not load file or assembly 'System.Web.Mvc' or one of its dependencies. The located assembly's manifest definition does not match the assembly 无法加载文件或程序集'System.Web.Mvc(1)'或其依赖项之一 - Could not load file or assembly 'System.Web.Mvc(1)' or one of its dependencies 无法加载文件或程序集 System.Web.Mvc 或其依赖项之一 - Could not load file or assembly System.Web.Mvc or one of its dependencies 找不到包含文档的“无法加载文件或程序集'System.Web.Mvc'或其依赖项之一” - Can't resolve “Could not load file or assembly 'System.Web.Mvc' or one of its dependencies” with documentation found 无法加载文件或程序集“System.Web.Mvc,Version = 3.0.0.0”或其依赖项之一 - Could not load file or assembly 'System.Web.Mvc, Version=3.0.0.0' or one of its dependencies 无法加载文件或程序集 'System.Web.WebPages.Razor,版本 = 1.0.0.0 或其依赖项之一。 该系统找不到指定的文件 - Could not load file or assembly 'System.Web.WebPages.Razor, Version=1.0.0.0 or one of its dependencies. The system cannot find the file specified “‘无法加载文件或程序集‘Elmah’或其依赖项之一。在 NuGet 中使用 Elmah.MVC 后,系统找不到指定的文件” - "'Could not load file or assembly 'Elmah' or one of its dependencies. The system cannot find the file specified'' after using Elmah.MVC in NuGet 无法加载文件或程序集“Microsoft.AI.Web”或其依赖项之一。 系统找不到指定的文件 - Could not load file or assembly 'Microsoft.AI.Web' or one of its dependencies. The system cannot find the file specified 无法加载文件或程序集或其依赖项之一。 拒绝访问 - Could not load file or assembly or one of its dependencies. Access is denied 无法加载文件或程序集“ xxxLib”或其依赖项之一。 BadImageFormatException - Could not load file or assembly 'xxxLib' or one of its dependencies. BadImageFormatException
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM