c# - FileLoadException while accessing assembly dlls in project application folder -


i want load assemblies stored inside project application folder on c: drive.

this code:

public static void main(string[] args) {                         assembly asm = null;     asm = assembly.loadfrom("c:\\sampleproj\\workspace\\test_app\\bin\\debug\\assemblies"); } 

the exception getting is:

could not load file or assembly 'file:///c:\sampleproj\workspace\test_app\bin\debug\assemblies' or 1 of dependencies. access denied.

i tried following, error remains same:

  1. keep project in other drive , access assemblies there
  2. removed read-only permission project folder-sub folders
  3. granted full control permissions users in project folder properties
  4. clicked on unblock button dll properties

please help.

as wrote in comment, not specifying valid path (you specifying folder when need specify dll). if want load assemblies in folder use piece of code:

private static list<assembly> assemblies = new list<assembly>();  private static void loadallassemblies(string path) {     foreach (var dir in directory.getdirectories(path))     {         loadallassemblies(path.combine(path, dir));     }      foreach (var file in directory.getfiles(path))     {         if (path.getextension(file) == ".dll")         {              assemblies.add(assembly.loadfrom(path.combine(path, file)));            }     } } 

Comments

Popular posts from this blog

database - VFP Grid + SQL server 2008 - grid not showing correctly -

jquery - Set jPicker field to empty value -

.htaccess - htaccess convert request to clean url and add slash at the end of the url -