【问题标题】:Appdata folder as DLL referenceAppdata 文件夹作为 DLL 参考
【发布时间】:2013-12-15 01:07:19
【问题描述】:

如何将 AppData 文件夹用作我的应用程序的 DLL 引用? 我不知道该怎么做... 我有 2 个 DLL 文件,我的应用程序将它们下载到我的应用程序 appdata 文件夹中。我如何才能将它们实际引用到我的应用程序中。

【问题讨论】:

    标签: c# reference appdata


    【解决方案1】:

    这应该会让你继续前进。根据 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);
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2013-04-17
      • 1970-01-01
      • 2015-12-21
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-08-01
      相关资源
      最近更新 更多