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 7808747
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T03:13:18+00:00 2026-06-02T03:13:18+00:00

I have an EXE that reference a DLL – for this example I’ll call

  • 0

I have an EXE that reference a DLL – for this example I’ll call it TestDLL.dll.
The EXE is written in C# and the DLL is written in VB .Net.

I created a demo assembly version of the DLL – for example – TestDLL.dll version 1.0.0.0.
I want to compile the EXE with a reference to the demo version DLL (1.0.0.0). Afterwards – I want the EXE to use the same DLL, but the one I’ll put in the GAC, of any version.
In order to do that, I set the “Copy Local” property of the DLL’s reference to FALSE.

My goal is for example – after compiling, I’ll put in the GAC TestDLL.dll with assembly version 2.1.6.0, and the EXE will find it using the assembly redirect binding. For that, I used a config file. I used this link to create it:
http://msdn.microsoft.com/en-us/library/7wd6ex19(v=vs.71).aspx

So my config file looks about like this:

<configuration>
   <runtime>
      <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
       <dependentAssembly>
         <assemblyIdentity name="myAssembly"
                           publicKeyToken="32ab4ba45e0a69a1"
                           culture="en-us" />
         <!-- Assembly versions can be redirected in application, publisher policy, or machine configuration files. -->
         <bindingRedirect oldVersion="1.0.0.0"
                          newVersion="2.1.6.0"/>
       </dependentAssembly>
      </assemblyBinding>
   </runtime>
</configuration>

The problem is that after doing all that, I run the EXE and when accessing the dll, I get the famous error:
System.IO.FileNotFoundException: Could not load file or assembly ‘TestDLL, Version=1.0.0.0, Culture=neutral, PublicKeyToken=9d8162944bd6fdc7’ or one of its dependencies. The system cannot find the file specified.
File name: ‘TestDLL, Version=1.0.0.0, Culture=neutral, PublicKeyToken=9d8162944bd6fdc7’

Meaning, the EXE can’t find the original DLL I referenced to.
I know that I can just “reference” the GAC or use reflection, but I don’t want to – since this EXE is supposed to work only this way.

Does anyone know what’s the problem and how to fix it?
Thanks

  • 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-06-02T03:13:20+00:00Added an answer on June 2, 2026 at 3:13 am

    Make sure that you have set the proper publicKeyToken. In the code you have shown you are using publicKeyToken="32ab4ba45e0a69a1" which is the public key token from the MSDN link. This obviously is not the public key token of your assembly. For this to work you need to have both assemblies (1.0.0.0 and 2.1.6.0) signed with the same key. To extract the public key token you could use the sn.exe tool or looked at the exception stack trace you are getting (it is telling you that publicKeyToken="9d8162944bd6fdc7"):

    sn.exe -Tp myassembly.dll
    

    But if the assembly that the executable was compiled against was not signed with the same key this won’t work.

    Also I see that you have set the culture="en-us" but does your assembly use this culture? You could also try culture="Neutral".

    Finally make sure that you have deployed the proper version of the assembly into the GAC.

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

Sidebar

Related Questions

I have an application written in .NET 4.0 that i compile into a DLL
I have an application (winform exe) that I run several times. Does this mean
I have an application that called several other .exe components written in delphi. The
I have a .NET v2.0 Dll that exposes a few classes to COM. The
I have a C# application program, let's call it App.exe. It references a DLL
I need to have a .NET 3.5 DLL have its own config file. This
I have a .exe assembly and a set of referenced assemblies that I would
I have an EXE that I want to distribute, but I don't want to
I have an exe that is built and placed into a Setup project for
I have a simple .exe that needs to be running continuously. Unfortunately, sometimes it

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.