.net 无法加载文件或程序集“Antlr3.Runtime (1)”或其依赖项之一
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/20180634/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Could not load file or assembly 'Antlr3.Runtime (1)' or one of its dependencies
提问by Maven
I'm getting this error while trying to run my MVC4project, it was working fine until last time on my other machines, but when I'm trying to run it from another machine it's giving me this error:
我在尝试运行我的MVC4项目时遇到此错误,直到上次在我的其他机器上它都运行良好,但是当我尝试从另一台机器上运行它时,它给了我这个错误:
Could not load file or assembly 'Antlr3.Runtime (1)' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
无法加载文件或程序集“Antlr3.Runtime (1)”或其依赖项之一。定位的程序集的清单定义与程序集引用不匹配。(来自 HRESULT 的异常:0x80131040)
After reading about this hereI've tried to do:
Install-Package Antlr3.Runtime -Pre
安装包 Antlr3.Runtime -Pre
but it didn't help, any ideas?
但这没有帮助,有什么想法吗?
回答by AH.
I encountered the same problem when experimenting with the free Nlog logging platform.
我在试用免费的 Nlog 日志平台时遇到了同样的问题。
This helped me:
这帮助了我:
Enter %TEMP% in the File Explorer and delete all the temporary files.
在文件资源管理器中输入 %TEMP% 并删除所有临时文件。
After that I didn't get the error when starting my MVC5 project in Visual Studio.
之后,我在 Visual Studio 中启动我的 MVC5 项目时没有收到错误消息。
回答by sachin kulkarni
Try to delete the temporary files for ASP.Net by doing one of these:
尝试通过执行以下操作之一来删除 ASP.Net 的临时文件:
- Enter %TEMP% in the File Explorer and delete all the temporary files.
- Go to folder "C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files" and delete all files.
- 在文件资源管理器中输入 %TEMP% 并删除所有临时文件。
- 转到文件夹“C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files”并删除所有文件。
回答by Mathijs Vlasveld
Don't forget to clear also the Temporary ASP.NET Files in Framework64. That did the trick for me.
不要忘记清除 .NET 中的临时 ASP.NET 文件Framework64。这对我有用。
C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET FilesC:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files
C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET FilesC:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files
回答by fhilton
Just in case this helps someone.
I had this problem with an MVC 5 Application. Deleting Antlr3.Runtime.dllfrom the bindirectory and re-building fixed the issue.
以防万一这对某人有帮助。
我在 MVC 5 应用程序中遇到了这个问题。从bin目录中删除Antlr3.Runtime.dll并重新构建修复了该问题。
回答by YeeHaw1234
My problem was that the latest version of WebGrease installs version 3.4.1.9004 of Antlr. Once I installed WebGrease and then updated Antlr to version 3.5.0.2, the error went away.
我的问题是最新版本的 WebGrease 安装了 Antlr 的 3.4.1.9004 版本。一旦我安装了 WebGrease,然后将 Antlr 更新到版本 3.5.0.2,错误就消失了。
回答by live-love
For me, removing this node in the web.config file got rid of the error message:
对我来说,在 web.config 文件中删除这个节点消除了错误消息:
<identity impersonate="true" userName="" password="">
But what really worked for me was granting full access (to the userName specified in impersonate), to the Temporary ASP.NET Files" folder found in C:\Windows\Microsoft.NET\Framework{version} (or Framework64).
但真正对我有用的是授予对 C:\Windows\Microsoft.NET\Framework{version}(或 Framework64)中的 Temporary ASP.NET Files" 文件夹的完全访问权限(对模拟中指定的用户名)。
The identity might also be stored in the Web Site Application Pool Settings, in IIS.
身份也可能存储在 IIS 中的网站应用程序池设置中。
Make sure your nuget package is correctly installed, with the correct version. If nothing else works, then just try re-adding the reference from a local folder and setting it to Copy Local.
确保您的 nuget 软件包安装正确,版本正确。如果没有其他效果,那么只需尝试从本地文件夹重新添加引用并将其设置为复制本地。
回答by Daniel Melo
If any solutions solve your problem verify the web.config, the version of assembly
如果任何解决方案解决了您的问题,请验证 web.config,程序集的版本
<dependentAssembly>
<assemblyIdentity name="Antlr3.Runtime" publicKeyToken="eb42632606e9261f" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-3.5.0.2" newVersion="3.5.0.2" />
</dependentAssembly>
回答by dee pan
The one of the simple way is update antlr and webgrease
一种简单的方法是更新 antlr 和 webgrease
- Goto Package console manager
- then try apply these codes one by one
- PM>Update-Package Antlr
- PM>Update-Package WebGrease
- 转到包控制台管理器
- 然后尝试一一应用这些代码
- PM>Update-Package Antlr
- PM>Update-Package WebGrease
Finally the Error Solved
终于解决了错误
回答by edson-
For me this was caused by a mismatch between the debug and runtime versions of Antlr.
对我来说,这是由 Antlr 的调试版本和运行时版本之间的不匹配引起的。
Finally solved it by installing a different Antlr package: Install-Package Antlr
最后通过安装不同的 Antlr 包解决了它:Install-Package Antlr
回答by ADM-IT
Try to unlock the Antlr3.Runtime.dll if you add reference manually:

如果您手动添加引用,请尝试解锁 Antlr3.Runtime.dll:


