|
-
May 15th, 2009, 01:32 PM
#1
Getting Assembly Version?
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:
Code:
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:
Code:
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,
-
May 18th, 2009, 02:52 AM
#2
Re: Getting Assembly Version?
1. Does the file exists on the given location? (e.g. the working dir is d:, but the windows folder is located on c
2. It is a .NET assembly, or common .dll?
- Make it run.
- Make it right.
- Make it fast.
Don't hesitate to rate my post. 
-
May 18th, 2009, 12:29 PM
#3
Re: Getting Assembly Version?
Yep, the file exists in the Window directory. The third party API that I use, they have two assembly files. To use their API, I have to include the .NET assembly to my project and another DLL is installed automatically into Windows directory when I install their CAB file. I'm able to get the version of the .Net assembly file, but when trying to get the DLL in Windows directory, it gives me error message like in my first post.
I don't understand your second question what is .NET assembly and common DLL. I guess maybe the DLL in Windows directory is common dll.
if you can help, very appreciated.
thanks.
Last edited by mase; May 18th, 2009 at 12:31 PM.
-
May 19th, 2009, 09:32 AM
#4
Re: Getting Assembly Version?
- Make it run.
- Make it right.
- Make it fast.
Don't hesitate to rate my post. 
-
May 19th, 2009, 04:33 PM
#5
Re: Getting Assembly Version?
boudino, thanks for the link. It has good information on it. From the example, can it be used in smart device runs on WinCe?
-
May 21st, 2009, 02:15 AM
#6
Re: Getting Assembly Version?
I suppose it could be, probably with some modifications, but I don't know it.
- Make it run.
- Make it right.
- Make it fast.
Don't hesitate to rate my post. 
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|