简体   繁体   English

你怎么知道你的c#应用程序使用的是哪个dll?

[英]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. 我有一个使用.dll的应用程序,它在位置x中充满了gui应用程序代码。 It use to have 1 button in, but now has 2. 它用来有1个按钮,但现在有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. 当我启动我的应用程序时,我期望看到的是一个带有2个按钮的gui,但是我看到一个带有1个按钮的gui。 i have rebuild my gui .dll but it is magically using an older version from somewhere. 我重建了我的gui .dll,但它神奇地使用了某个地方的旧版本。 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 如果我尝试调试我的代码,它说我使用的代码版本与.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?" 我的问题是,“我如何才能找到它在哪里寻找.dll以及为什么它会使用旧版本,因为我只有一个地方可以将.dll编译成?”

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??? 还想说明我已经引用它,它是正确的版本,其中有2个按钮..但是当我运行它是使用另一个版本???

If you are using Visual Studio open the Modules window, Debug->Windows->Modules (Ctrl-D+M) and this will list all loaded assemblies. 如果您使用的是Visual Studio,请打开“模块”窗口,调试 - > Windows->模块(Ctrl-D + M),这将列出所有已加载的程序集。

You can also at run time use AppDomain.CurrentDomain.GetAssemblies() and walk the list looking at each Assembly.CodeBase. 您还可以在运行时使用AppDomain.CurrentDomain.GetAssemblies()并查看每个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. 如果所有其他方法都失败了,您也可以使用sysinternals中的ProcessMonitor http://technet.microsoft.com/en-us/sysinternals/bb896645并查看您的进程加载了哪些dll,但是您将过滤掉大量的输出。

If you are debugging you can open the Modules window ( Debug > Windows > Modules ). 如果您正在调试,可以打开“ 模块”窗口(“ 调试” >“ Windows” >“ 模块” )。 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. 然后,您应该能够找出加载了过时DLL的位置。

You could try using Reflection in the System.Reflection namespace: 您可以尝试在System.Reflection命名空间中使用Reflection

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

And then examine the assembly object for version info. 然后检查assembly对象的版本信息。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 您如何发布或部署您的 C# 桌面应用程序? - How do you publish or deploy your C# desktop application? C#:如何确定在ListView中选择了哪个项目索引? - C#: How do you tell which item index is selected in ListView? 如何判断你是在自己的构造函数中,还是在c#中的基类构造函数 - How to tell if you are in your own constructor, or your base class's constructor in c# 在Visual Studio C#中使用自定义DLL时,如何显示自定义的intellisense注释? - How do you get custom intellisense comments to appear when using a custom DLL in Visual Studio C#? 如何从C#中的DLL中找到基本URL? - How do you find the base url from a DLL in C#? 如何将C .DLL文件导入C#Windows窗体应用程序并调用其在标头中定义的函数? - how do you import a C .DLL file to a C# windows form application and call its functions that are defined in headers? 在C#代码中如何以及在何处使用断言? - How and where are you using Assertions in your c# code? 按下任意键后,您将如何刷新应用程序? C# - How would you go about refreshing your application once you have pressed any key? C# 您如何判断要在Windows CE中使用C#运行的体系结构? - How do you tell the architecture you're running on in Windows-CE in C#? 如何使用 MSBuild 为 C# 应用程序创建 DLL? - How to create DLL for C# application using MSBuild?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM