mase
May 15th, 2009, 01:32 PM
Hello everyone,
I have been trying to get the assembly version of the third party DLL that I use in my program, but I'm unable to retrieve it and I can not seem to know why. When I create my own DLL just for testing, it works, but when apply the same method to retrieve third party DLL, it doesn't work.
This works when I try to get the version of my own test DLL:
string assemblyPath = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.LoadFrom(@"\Windows\TestLogFile.dll").GetName().CodeBase);
listBox1.Items.Add(assemblyPath);
System.Version objVersion1 = System.Reflection.Assembly.LoadFrom(assemblyPath + @"\TestLogFile.dll").GetName().Version;
testMsg.Text = objVersion1.ToString();
But when I try the same approach just to get the path to the third party DLL, but can't get it:
string assemblyPath = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.LoadFrom(@"\Windows\DMRK.dll").GetName().CodeBase);
listBox1.Items.Add(assemblyPath);
Error: File or assembly name "\Windows\DMRK.dll"; or one of its dependencies, was not found.
Does anybody know why?
thanks,
I have been trying to get the assembly version of the third party DLL that I use in my program, but I'm unable to retrieve it and I can not seem to know why. When I create my own DLL just for testing, it works, but when apply the same method to retrieve third party DLL, it doesn't work.
This works when I try to get the version of my own test DLL:
string assemblyPath = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.LoadFrom(@"\Windows\TestLogFile.dll").GetName().CodeBase);
listBox1.Items.Add(assemblyPath);
System.Version objVersion1 = System.Reflection.Assembly.LoadFrom(assemblyPath + @"\TestLogFile.dll").GetName().Version;
testMsg.Text = objVersion1.ToString();
But when I try the same approach just to get the path to the third party DLL, but can't get it:
string assemblyPath = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.LoadFrom(@"\Windows\DMRK.dll").GetName().CodeBase);
listBox1.Items.Add(assemblyPath);
Error: File or assembly name "\Windows\DMRK.dll"; or one of its dependencies, was not found.
Does anybody know why?
thanks,