How can I use the AppData folder as a DLL reference for my application? I have no clue how to do that... I have 2 DLL files that my application downloads to my applications appdata folder.. And how can I actually reference them to my application..
Asked
Active
Viewed 1,074 times
1 Answers
0
This should get you going. Per MSDN. http://msdn.microsoft.com/en-us/library/25y1ya39.aspx. Also, your AppData folder path is Environment.SpecialFolder.ApplicationData`.
This works for external assembly dlls. For native dll, use the extern
syntax.
using System.Reflection;
public static void Main()
{
// Use the file name to load the assembly into the current
// application domain.
Assembly a = Assembly.Load("example");
// Get the type to use.
Type myType = a.GetType("Example");
// Get the method to call.
MethodInfo myMethod = myType.GetMethod("MethodA");
// Create an instance.
object obj = Activator.CreateInstance(myType);
// Execute the method.
myMethod.Invoke(obj, null);
}

drankin2112
- 4,715
- 1
- 15
- 20