[英]Appdata folder as DLL reference
How can I use the AppData folder as a DLL reference for my application? 如何将AppData文件夹用作应用程序的DLL参考? 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..
我不知道该怎么做...我有2个DLL文件,我的应用程序将这些文件下载到我的应用程序appdata文件夹中。如何实际引用它们到我的应用程序中。
This should get you going. 这应该可以帮助您。 Per MSDN.
根据MSDN。 http://msdn.microsoft.com/en-us/library/25y1ya39.aspx .
http://msdn.microsoft.com/zh-cn/library/25y1ya39.aspx 。 Also, your AppData folder path is Environment.SpecialFolder.ApplicationData`.
另外,您的AppData文件夹路径为Environment.SpecialFolder.ApplicationData`。
This works for external assembly dlls. 这适用于外部程序集dll。 For native dll, use the
extern
syntax. 对于本机dll,请使用
extern
语法。
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);
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.