4

Something on our MVC 4 project, on my computer, seems very broken :( It started out with the project suddenly thinking it's a Windows project, I could add no views or controllers. I repaired it to the point where it is MVC again, but 1) it has no Intellisense for Razor, and 2) it doesn't start, showing this error:

Die Datei oder Assembly "Antlr3.Runtime" oder eine Abhängigkeit davon wurde nicht gefunden. Die gefundene Manifestdefinition der Assembly stimmt nicht mit dem Assemblyverweis überein. (Ausnahme von HRESULT: 0x80131040)

(sorry, no full exact English translation found. It means that it is trying to load the wrong version of the Antlr3.Runtime).

What I tried and didn't work:

  • Deleting all files in %TEMP%
  • cleaning and rebuilding the solution
  • uninstalling Antlr3 and dependent libraries (it is required by MVC optimization, which seems to be connected to the Intellisense problem). Updated NuGet manager, then re-installed Antlr and the others.
  • Checked the properties of the Antlr3 reference. It is set to "Specific version -> false" and in Web.config, I have the entry

      <dependentAssembly>
    <assemblyIdentity name="Antlr3.Runtime" publicKeyToken="eb42632606e9261f" 
    culture="neutral" />
    <bindingRedirect oldVersion="0.0.0.0-3.5.0.2" newVersion="3.5.0.2" />
    

The strange thing is that

  • when I create a new MVC project, it works
  • the project works on my co-worker's computer just fine.

Because of the second point, I completely abandoned my old workspace, created a new one, and got the project fresh from TFS. I also did a diff on our .csproj files. This was before I attempted the solutions above. It still didn't help.

Any ideas what I could do from here?

Rumi P.
  • 1,688
  • 3
  • 23
  • 31
  • Possible duplicate of [Could not load file or assembly 'Antlr3.Runtime (1)' or one of its dependencies](https://stackoverflow.com/questions/20180634/could-not-load-file-or-assembly-antlr3-runtime-1-or-one-of-its-dependencies) – Chris Moschini Nov 17 '17 at 14:54

3 Answers3

1

The solution turned out to be to choose the bad assembly in the References, open its Properties, and set Copy Local to false. For good measure, I also manually deleted the .dll from both its own folder and the Debug and Bin folders, and got a copy from my co-worker's machine into its Antlr folder. After that, the project started displaying correctly in the browser.

Once that was covered, installing the Tools for Visual Studio 2013 took care of the Intellisense problem.

Rumi P.
  • 1,688
  • 3
  • 23
  • 31
1

This helped for me (and I feel pretty comfy with it, because I did not have to change any obscure settings or delete files I really don't know)

  1. comment-out the line <package id="Antlr" version="3.4.1.9004" targetFramework="net45"/> from the file packages.config.
  2. recompile and run -> no problems appear
  3. make the line <package id="Antlr" version="3.4.1.9004" targetFramework="net45"/> active again.
Peter Klein
  • 1,010
  • 1
  • 10
  • 19
0

If none of the above can solve your problem, pls see my answer here: Could not load file or assembly 'Antlr3.Runtime' or one of its dependencies

Community
  • 1
  • 1
cheny
  • 2,545
  • 1
  • 24
  • 30