Mar*_*arc 1 .net c# reflection
我有两个程序集A.exe和B.exe.两者都是Windows.Forms .net 3.5程序集.A.exe知道B.exe在同一目录中.
如何从A.exe中找到B.exe 的ProductName?
FileVersionInfo类在这里很有用.[AssemblyProduct]属性被编译到非托管版本信息资源中.此代码适用于任何.exe:
private void button1_Click(object sender, EventArgs e) {
var info = System.Diagnostics.FileVersionInfo.GetVersionInfo(@"c:\windows\notepad.exe");
MessageBox.Show(info.ProductName);
}
Run Code Online (Sandbox Code Playgroud)