反正有没有获得参考的汇编版本? C# [英] Is there anyway to get an reference's assembly version? C#

查看:84
本文介绍了反正有没有获得参考的汇编版本? C#的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试创建一个从文件夹中抓取插件并将其输入程序的系统。问题是,我想从插件中获取PluginLib的版本,以便我可以看到插件是否是最新的。有没有办法做到这一点?如果我没有从插件中获取版本,程序将崩溃,因为插件在更新时不符合lib的接口要求。



- 我有一个插件

- 该插件取决于PluginLib



- 我想检查PluginLib插件是否正在使用的是与节目

正在使用的节目相同。



我的尝试:



我找不到任何方法来隐藏PluginsLib版本插件,因为插件引用了一个接口,而不是一个抽象类。

Hi, I'm trying to make a system that grabs plugins from a folder and inputs them into the program. The problem is, I want to get the PluginLib's version off of the plugins so I can see if the plugins are up to date. Is there any way to do this? If I don't grab the version off of the plugins, the program will crash because the plugins don't match the lib's interface requirements when I update it.

- I have a Plugin
- That Plugin Depends off of a PluginLib

- I want to check if the PluginLib the Plugin is using is the same as the one the program
is using.

What I have tried:

I could not find any way to hide a PluginLib version inside of the Plugins because the plugins reference an interface, not an abstract class.

推荐答案

试试这个:

Try this:
FileVersionInfo versionInfo = FileVersionInfo.GetVersionInfo(@"C:\MyPlugin.dll");
Console.WriteLine ("Version number: " + versionInfo.FileVersion);

/ ravi


这篇关于反正有没有获得参考的汇编版本? C#的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆