Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6138791
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T17:54:36+00:00 2026-05-23T17:54:36+00:00

I know this question seems to be answered all over stackoverflow and the web,

  • 0

I know this question seems to be answered all over stackoverflow and the web, but my issue is different.

I am trying to understand how to not use the GAC (boss says no) when I have the following setup:

The project uses NHibernate, and Antlr3.Stringtemplate
Both of which are third party assemblies.
NHibernate has a reference to Antlr3.Runtime version 3.1.3.42154
Antlr3.Stringtemplate has a reference to Antlr3.Runtime version 3.3.1.7705

One will error when the other is not available.

I tried binding redirect, but this does not work because the publicKeyToken is different between the versions. It ends up looking for a 3.3.17705 with a public key token that matches the 3.1.3.42154 version.

Installing one, or both, in the GAC works. However, my boss won’t let me install anything into the GAC.

I also tried putting both DLLs in the BIN directory, by including a Lib project with a folder for version 3.1.3.42154.
I told it to copy always and so I get /bin/Lib/3.1.3.42154/Antlr.Runtime.dll
Then I added a probing element to probe that directory.
This did not work, and I got the same exact error.

How can you use third party assemblies that reference another third party assembly, both both reference different versions?

UPDATE:

    System.Reflection.Assembly.LoadFile(@"Antlr3.Runtime.dll"); // 3.3.1        
    System.Reflection.Assembly.LoadFile(@"Antlr3.Runtime\Antlr3.Runtime.dll"); // 3.1.3

AppDomain.CurrentDomain.GetAssemblies() shows that the versions are loaded in the app domain, however, it still errors saying thta 3.1.3 cannot be found.

The following is whats loaded from AppDomain.CurrentDomain.GetAssemblies() right before the invocation to the code that errors. The first 2 lines are whats in GetAssemblies() the third line is what the error says is missing.

{Antlr3.Runtime, Version=3.3.1.7705, Culture=neutral, PublicKeyToken=eb42632606e9261f}
{Antlr3.Runtime, Version=3.1.3.42154, Culture=neutral, PublicKeyToken=3a9cab8f8d22bfb7}
 Antlr3.Runtime, Version=3.1.3.42154, Culture=neutral, PublicKeyToken=3a9cab8f8d22bfb7
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T17:54:36+00:00Added an answer on May 23, 2026 at 5:54 pm

    Solved the problem.

    This is a specific issue with using Antlr3.StringTemplate
    The guy who made stringtemplate actually downloaded the source of antlr and built it with his application instead of distributing the original antlr dll. His new antlr dll has the same name, but different signature. He changes the version, and the public key token of it. So it causes very bad conflicts if you try to use the original with things such as NHibernate.

    So the solution was to use ILMerge to merge his custom Antlr3 DLL into the string.template DLL to make the string.template dll dependent on nothing but itself. I merged Antlr3.Runtime.dll, Antlr3.StringTemplate.dll, and Antlr3.Runtime.Debug.dll into a single DLL Antlr3.StringTemplate.dll

    This removed all DLL conflicts, and I was able to include the Antlr3.Runtime.dll that nhibernate needs. The guy who produces stringtemplate should just distribute his package this way too.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I know this seems like a repeat question, but i've read all the others
I know this might seem a controversial question but it really is not meant
I know this question has been asked and answered before, but none of the
I know this is probably a common and easily answered question, but I'm a
I know this question may sound silly, but I am learning (at least trying)
Warning - I am very new to NHibernate. I know this question seems simple
I know this seams a trivial question, but how can I disable the annoying
I know this maybe a basic question but I just can't seem to find
I know this is a subjective question, but why does Hibernate seem to be
Alright, I know this is a simple question, but I can't seem to get

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.