Click here to Skip to main content
15,917,565 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
My application loads a .dll at runtime
Assembly.Loadfile


When the application runs by right click + click on application , it searches for the .dll in the windows folder [ System32 folder ]

Sometimes if the application is delivered through an msi setup it works fine but for direct copy/paste deployement it always gives error that .dll could not be found.

Any help with this would be greatly appreciated.

Regards,
Ramlagan M

Updated on 30-August-2011
It is Managed dll.
Whenever I run the application it creates

icon of the application in taskbar.
Now if i right click on this taskbar icon

it shows me 3 menus
1. Close Window
2. Pin this program to taskbar
3. My Application [ say abc ]

Now if i click on abc it creates new instance of the application but this time
exe search for dll in system32 folder [ Assembly.Loadfile ] where it is not available.
Posted
Updated 29-Aug-11 22:40pm
v4
Comments
Slacker007 25-Aug-11 6:42am    
Edit: readability.

You must be using an unmanaged dll that needs to be registered on the system.
If you copy / paste, try registering the dll using RegSvr32.
 
Share this answer
 
Comments
koolprasad2003 25-Aug-11 10:05am    
Nice! 5.
Abhinav S 25-Aug-11 10:07am    
Thank you.
fjdiewornncalwe 25-Aug-11 10:18am    
Agreed.
Abhinav S 25-Aug-11 10:19am    
Thanks Marcus.
When u install your application with MSI, it will register your .dll. and when u copy/paste your directory structure and try to run application directly, your unregistered dll gives you error.

yes. as Abhinav said, register your dll with regsvr32 "dll file path".
 
Share this answer
 
 
Share this answer
 
In Windows 7 the System32 is a reserved location.
You may be having issue with dll's actually residing in the virtual store (or the app searching in the virtual store)

Can you try copying/pasting to a different location and calling Assembly.Load from this location.

PS: The virtual store is located here
C:\Users\[user name]\AppData\Local\VirtualStore
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900