pengibot
pengibot

Reputation: 1552

How do you tell which dll your c# application is using?

I have an application which uses a .dll which is full of gui application code in location x. It use to have 1 button in, but now has 2.

When i start my application what i expect to see is a gui with 2 buttons, however i see a gui with 1 button. i have rebuild my gui .dll but it is magically using an older version from somewhere. If i try and debug my code it says that the version of code i am using is different from the one in the .dll

My question is, "How can i find out where it is looking for the .dll and why would it be using an old version as i only have 1 place where i compile the .dll to?"

Also wanted to state that i have it referenced and it is the correct version which has the 2 buttons in.. but when i run it is using another version???

Upvotes: 2

Views: 6769

Answers (3)

AlSki
AlSki

Reputation: 6961

If you are using Visual Studio open the Modules window, Debug->Windows->Modules (Ctrl-D+M) and this will list all loaded assemblies.

You can also at run time use AppDomain.CurrentDomain.GetAssemblies() and walk the list looking at each Assembly.CodeBase.

If all else fails you can also use Process Monitor from Sysinternals http://technet.microsoft.com/en-us/sysinternals/bb896645 and watch which dlls are loaded by your process, but you'll be filtering out tons of output.

Upvotes: 4

Martin Liversage
Martin Liversage

Reputation: 106836

If you are debugging you can open the Modules window (Debug > Windows > Modules). This will show you all the executable files loaded into your process including the name and full path. You should then be able to figure out from where an out-of-date DLL was loaded.

Upvotes: 1

Paul Aldred-Bann
Paul Aldred-Bann

Reputation: 6020

You could try using Reflection in the System.Reflection namespace:

var assembly = Assembly.Load("your-assembly-name");

And then examine the assembly object for version info.

Upvotes: 0

Related Questions