Click here to Skip to main content
15,887,214 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi,

I am facing the following FileNotFoundExemption when I run the .exe file outside visual studio 2015 directory.How can I correct the assembly error.

************** Exception Text **************
System.IO.FileNotFoundException: Could not load file or assembly 'WinUSBNet, Version=1.0.3.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.
File name: 'WinUSBNet, Version=1.0.3.0, Culture=neutral, PublicKeyToken=null'
at xxxxxxxxxxxxxxxxxxxxxxxxxxx(Object sender, EventArgs e)
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

WRN: Assembly binding logging is turned OFF.
To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.
Note: There is some performance penalty associated with assembly bind failure logging.
To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].

What I have tried:

I was running in debug configuration.Changed configuration to release and placed .exe file out of visual studio folder while running from that location error occured in library.
Posted
Updated 24-Apr-18 18:11pm
v2
Comments
F-ES Sitecore 24-Apr-18 7:52am    
If you do what the error suggests and enable the assembly bind failure logging it will tell you all the folders it has looked in for the relevant assembly. Make sure the assembly is in one of them along with any assemblies that assembliy relies on. .net exe files are not self-contained or stand-alone, they need access to the components they rely on.
Member 13688117 25-Apr-18 0:19am    
Thank you

The WinUSBNet DLL must be in the same directory as the executable.

Check your solution for difference between debug and release builds (e.g. building the DLL not in release mode or having specified a different output directory for release build).
 
Share this answer
 
Comments
Member 13688117 25-Apr-18 0:14am    
Sorry that my question was not clear.In my normal execution in the project folder both release and debug version runs fine.I need to share the .exe file.When I changed the folder its running properly till where it need to access the winusbnet library.After that it shows the above error.
Member 13688117 25-Apr-18 0:18am    
Thank you so much for your answer.I found that even while sharing the .exe I should keep the dll along with exe in the same folder.Now its working fine.
This is telling you that an assembly you require is not present in the release directory, or cannot be located in a search path. The first, and most obvious thing, is to take a look in this directory and see if WinUSBNet is located in there. If it is, then you need to look at what the dependencies on that file are (you can use SysInterals depends[^] to identify this).
 
Share this answer
 
Comments
Member 13688117 25-Apr-18 0:19am    
Thank you for your reply.

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