2013-12-15 78 views
0

如何將AppData文件夾用作我的應用程序的DLL參考? 我不知道該怎麼做... 我有2個DLL文件,我的應用程序下載到我的應用程序appdata文件夾..我怎麼能實際參考他們到我的應用程序..作爲DLL參考的Appdata文件夾

回答

0

這應該讓你走。每個MSDN。 http://msdn.microsoft.com/en-us/library/25y1ya39.aspx。另外,你的AppData文件夾路徑是Environment.SpecialFolder.ApplicationData`。

這適用於外部裝配dll。對於本地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); 
}