简体   繁体   English

C# 当我链接到 dll

[英]C# get error Method not found :System.Security.AccessControl.FileSecurity System.IO.File.GetAccessControl(System.String) when I link to dll

So I am working on a project which need to use a dll called Loadengine.dll, I follow the steps in the manual, but when I run the application the error pop up Method not found:System.Security.AccessControl.FileSecurity System.IO.File.GetAccessControl(System.String) I don't know what happend.所以我正在做一个项目,需要使用一个名为 Loadengine.dll 的 dll,我按照手册中的步骤操作,但是当我运行应用程序时,错误弹出Method not found:System.Security.AccessControl.FileSecurity System.IO.File.GetAccessControl(System.String)我不知道发生了什么。 I didn't call this method in my code.我没有在我的代码中调用这个方法。

Program.cs程序.cs

namespace wcb
{
using System.Reflection;
using System.IO;
using Microsoft.VisualBasic.ApplicationServices;
using System.Windows.Forms;
using System;

internal static class Program
{
    /// <summary>
    ///  The main entry point for the application.
    /// </summary>
    
    [STAThread]
    static void Main()
    {
        // To customize application configuration such as set high DPI settings or default font,
        // see https://aka.ms/applicationconfiguration.
        AppDomain.CurrentDomain.AssemblyResolve += new ResolveEventHandler(CurrentDomain_AssemblyResolve);
        ApplicationConfiguration.Initialize();
        Application.Run(new Form1());
    }
    static System.Reflection.Assembly CurrentDomain_AssemblyResolve(object sender, ResolveEventArgs args)
    {
        List<string> engineDlls = new List<string>();
        engineDlls.AddRange(new string[] { "LoaderEngine", "RFMDMPSSE", "Bin", "Utilities" });
        AssemblyName assemblyName = new AssemblyName(args.Name);
        if (engineDlls.Contains(assemblyName.Name))
        {
            string dllLocation = "C:\\Users\\jay.lin\\AppData\\Local\\Programs\\Qorvo\\RF Optimizer\\"+ assemblyName.Name + ".dll";
            if (File.Exists(dllLocation))
            {
                return Assembly.LoadFrom(dllLocation);
            }
        }
        return null;
    }
}
}

Form1.cs Form1.cs

namespace wcb
{
public partial class Form1 : Form
{
    private LoaderEngine.LoaderEngine engine;
    public Form1()
    {
        InitializeComponent();
        engine = new LoaderEngine.LoaderEngine();
        engine.InitializeEngine("");
        
    }

}
}

错误弹出

It may be that Loadengine refers to an old version of the dll of the same name and gives the path in the program, but it may also be included, and the referenced assembly version conflicts.可能是Loadengine引用了旧版本的同名dll并给出了程序中的路径,但也有可能被包含,引用的程序集版本冲突。

You should make sure to deploy the latest DLL and check the folder for no hidden duplicate old assemblies, and recompile.您应该确保部署最新的 DLL 并检查文件夹中没有隐藏的重复旧程序集,然后重新编译。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 发布表单C#时出现System.String []错误 - System.String[] error when posting form C# System.String [*]和System.String [] C#的区别 - System.String[*] and System.String[] Difference in C# 对于C#中的用户控件,我收到的错误就像“类型&#39;上的构造函数&#39;system.string&#39;找不到”? - I am getting error like “constructor on type 'system.string' cannot found” for a User Control in C#? ExpressionTree-GetSetMethod错误:未为类型&#39;System.String&#39;定义方法&#39;System.String get_Name()&#39; - ExpressionTree - GetSetMethod Error: Method 'System.String get_Name()' is not defined for type 'System.String' 找不到Swagger方法IncludeXmlComments(System.String) - Swagger Method not found IncludeXmlComments(System.String) 方法未找到:&#39;System.String System.String.Format(System.IFormatProvider, System.String, System.Object) - Method not found: 'System.String System.String.Format(System.IFormatProvider, System.String, System.Object) 找不到方法:&#39;System.String System.String.Format(System.IFormatProvider,System.String,System.Object)&#39; - Method not found: 'System.String System.String.Format(System.IFormatProvider, System.String, System.Object)' 使用c#在数据库调用上出现System.String ToString()错误 - System.String ToString() error on a database call using c# 清除C#中的System.String - Clearing a System.String in C# System.MissingMethodException:找不到方法:&#39;System.String .get_DayName()&#39; - System.MissingMethodException: Method not found: 'System.String .get_DayName()'
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM