locked
How can I load assemblies that are placed in the project (portable class library) folder? RRS feed

  • Question

  • have a .dll file in my project folder and would like to load it via Assembly.Load().

    AssemblyName name = new AssemblyName("Portable.Store, Version=0.1.0.0, Culture=neutral, PublicKeyToken=12ay62c33eocf6uf");

    Assembly assembly = Assembly.Load(name);

    However this would throw a FileNotFoundException due to not specifying a path. And I am unable to use Assembly.LoadFrom() because Portable Class Libraries only support Assembly.Load

    Is there a way to do this inside a pcl? Any help is appreciated, thank you!


    • Edited by Ryan.dn Wednesday, August 14, 2013 6:42 PM
    Wednesday, August 14, 2013 6:15 PM

All replies

  • Hi,Ryan.dn

    What is the "Portable.Store".The simple name is typically the file name for the manifest file without its extension.Make sure you write the right simple name in your code.You can refer to this link below to know how to describe an assembly's unique identity in full:

    http://msdn.microsoft.com/en-us/library/system.reflection.assemblyname.aspx

    Also,you must add the .dll file in the right position .In windows store app,the .dll file contained in the app package installedlocation.

    Best Wishes!

    Thursday, August 15, 2013 9:05 AM
  • Thanks for the response Anne! Portable.Store is the same of the file without the extension. 

    So the way my project is setup right now is I have  PCL and a Windows Store app. Inside the PCL project I have added the dll as an embedded resource or content. And I would call Assembly.Load inside the PCL. However it still would throw a FileNotFoundException

    Thursday, August 15, 2013 3:31 PM
  • Hi Ryan,

    Is the PCL being deployed with the package? Select its properties in the project explorer and make sure it is marked as content and to copy to the output directory. After deploying you can double check that it is in the app's installed directory.

    --Rob

    Thursday, August 15, 2013 3:45 PM
    Moderator
  • Yes the PCL is being deployed with the package. I tried changing properties of the dll as you stated above but the dll is still not inside the app's installed directory.

    Could this be because the dll is a non pcl library?

    Monday, August 19, 2013 7:03 PM