简体   繁体   中英

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???

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 ProcessMonitor 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.

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM