简体   繁体   English

无法从另一台计算机加载DLL

[英]Cannot load dll from another computer

I have an issue with loading a dll from another computer. 我有从另一台计算机加载DLL的问题。 It loads pretty fine from my station but when I tried testing it from another system that hasn't got Visual Studio installed, I get the following exception: 它从我的工作站加载非常好但是当我尝试从没有安装Visual Studio的另一个系统测试它时,我得到以下异常:

Date - 10 May 2012 12:01:48.0725000 - Exception has been thrown by the target of an invocation. 日期 - 2012年5月10日12:01:48.0725000 - 调用目标抛出了异常。 Date - 10 May 2012 12:01:48.0881250 - System.IO.FileNotFoundException: Could not load file or assembly 'System.Xml.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' or one of its dependencies. 日期 - 2012年5月10日12:01:48.0881250 - System.IO.FileNotFoundException:无法加载文件或程序集'System.Xml.Linq,Version = 3.5.0.0,Culture = neutral,PublicKeyToken = b77a5c561934e089'或其依赖项之一。 The system cannot find the file specified. 该系统找不到指定的文件。 File name: 'System.Xml.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' at ZENNLNGLIB.Process.ReadConfigFile() at ZENNLNGLIB.Process.ProcessFile(String fileName) 文件名:'System.Xml.Linq,Version = 3.5.0.0,Culture = neutral,PublicKeyToken = b77a5c561934e089'ZENNLNGLIB.Process.ReadConfigFile()at ZENNLNGLIB.Process.ProcessFile(String fileName)

Assembly manager loaded from: C:\\WINDOWS\\Microsoft.NET\\Framework\\v2.0.50727\\mscorwks.dll Running under executable C:\\Documents and Settings\\Administrator\\Desktop\\NLNG.Encryption\\NLNG.Encryption\\bin\\Debug\\NLNG.Encryption.exe --- A detailed error log follows. 程序集管理器从以下位置加载:C:\\ WINDOWS \\ Microsoft.NET \\ Framework \\ v2.0.50727 \\ mscorwks.dll在可执行文件C下运行:\\ Documents and Settings \\ Administrator \\ Desktop \\ NLNG.Encryption \\ NLNG.Encryption \\ bin \\ Debug \\ NLNG .Encryption.exe ---下面是一个详细的错误日志。

=== Pre-bind state information === LOG: User = WS001ITS106\\Administrator LOG: DisplayName = System.Xml.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 (Fully-specified) LOG: Appbase = file:///C:/Documents and Settings/Administrator/Desktop/NLNG.Encryption/NLNG.Encryption/bin/Debug/ LOG: Initial PrivatePath = NULL Calling assembly : ZENNLNGLIB, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null. ===预绑定状态信息=== LOG:User = WS001ITS106 \\ Administrator LOG:DisplayName = System.Xml.Linq,Version = 3.5.0.0,Culture = neutral,PublicKeyToken = b77a5c561934e089(完全指定)LOG:Appbase = file:/// C:/ Documents and Settings / Administrator / Desktop / NLNG.Encryption / NLNG.Encryption / bin / Debug / LOG:Initial PrivatePath = NULL调用程序集:ZENNLNGLIB,Version = 1.0.0.0,Culture = neutral,PublicKeyToken = NULL。 === LOG: This bind starts in LoadFrom load context. ===日志:此绑定在LoadFrom加载上下文中启动。 WRN: Native image will not be probed in LoadFrom context. 警告:不会在LoadFrom上下文中探测本机映像。 Native image will only be probed in default load context, like with Assembly.Load(). 原生图像只能在默认加载上下文中进行探测,就像使用Assembly.Load()一样。 LOG: No application configuration file found. 日志:找不到应用程序配置文件。 LOG: Using machine configuration file from C:\\WINDOWS\\Microsoft.NET\\Framework\\v2.0.50727\\config\\machine.config. 日志:使用C:\\ WINDOWS \\ Microsoft.NET \\ Framework \\ v2.0.50727 \\ config \\ machine.config中的计算机配置文件。 LOG: Post-policy reference: System.Xml.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 LOG: Attempting download of new URL file:///C:/Documents and Settings/Administrator/Desktop/NLNG.Encryption/NLNG.Encryption/bin/Debug/System.Xml.Linq.DL L. LOG: Attempting download of new URL file:///C:/Documents and Settings/Administrator/Desktop/NLNG.Encryption/NLNG.Encryption/bin/Debug/System.Xml.Linq/Sy stem.Xml.Linq.DLL. 日志:后策略引用:System.Xml.Linq,Version = 3.5.0.0,Culture = neutral,PublicKeyToken = b77a5c561934e089日志:尝试下载新的URL文件:/// C:/ Documents and Settings / Administrator / Desktop / NLNG .Encryption / NLNG.Encryption / bin / Debug / System.Xml.Linq.DL L.日志:尝试下载新的URL文件:/// C:/ Documents and Settings / Administrator / Desktop / NLNG.Encryption / NLNG.Encryption /bin/Debug/System.Xml.Linq/Sy stem.Xml.Linq.DLL。 LOG: Attempting download of new URL file:///C:/Documents and Settings/Administrator/Desktop/NLNG.Encryption/NLNG.Encryption/bin/Debug/System.Xml.Linq.EXE. 日志:尝试下载新的URL文件:/// C:/ Documents and Settings / Administrator / Desktop / NLNG.Encryption / NLNG.Encryption / bin / Debug / System.Xml.Linq.EXE。 LOG: Attempting download of new URL file:///C:/Documents and Settings/Administrator/Desktop/NLNG.Encryption/NLNG.Encryption/bin/Debug/System.Xml.Linq/System.Xml.Linq.EXE. 日志:尝试下载新的URL文件:/// C:/ Documents and Settings / Administrator / Desktop / NLNG.Encryption / NLNG.Encryption / bin / Debug / System.Xml.Linq / System.Xml.Linq.EXE。 LOG: Attempting download of new URL file:///C:/zennlnglib/System.Xml.Linq.DLL. 日志:尝试下载新的URL文件:/// C:/zennlnglib/System.Xml.Linq.DLL。 LOG: Attempting download of new URL file:///C:/zennlnglib/System.Xml.Linq/System.Xml.Linq.DLL. 日志:尝试下载新的URL文件:/// C:/zennlnglib/System.Xml.Linq/System.Xml.Linq.DLL。 LOG: Attempting download of new URL file:///C:/zennlnglib/System.Xml.Linq.EXE. 日志:尝试下载新的URL文件:/// C:/zennlnglib/System.Xml.Linq.EXE。 LOG: Attempting download of new URL file:///C:/zennlnglib/System.Xml.Linq/System.Xml.Linq.EXE. 日志:尝试下载新的URL文件:/// C:/zennlnglib/System.Xml.Linq/System.Xml.Linq.EXE。

This is how I'm loading my dll: 这是我加载我的DLL的方式:

Assembly u = Assembly.LoadFrom(@"C:\test\test.dll");

    Type t = u.GetType("Test.Process");
    MethodInfo m = t.GetMethod("ProcessFile");

    try
    {
        object[] myparam = new object[1];
        myparam[0] = @"C:\test\testFile.csv";

        result = (string)m.Invoke(null, myparam);

        Console.WriteLine(result);
    }
    catch (Exception ex)
    {
        Console.WriteLine(ex.Message.ToString());
        Console.WriteLine(ex.InnerException.ToString());
        System.Threading.Thread.Sleep(100000);
    }

System.IO.FileNotFoundException: Could not load file or assembly 'System.Xml.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' or one of its dependencies. System.IO.FileNotFoundException:无法加载文件或程序集'System.Xml.Linq,Version = 3.5.0.0,Culture = neutral,PublicKeyToken = b77a5c561934e089'或其依赖项之一。 The system cannot find the file specified 该系统找不到指定的文件

pretty says what happens. 漂亮说会发生什么。 Check if the right version (3.5) of the .NET Framework is installed on the other machine where the error occurs. 检查是否在发生错误的其他计算机上安装了.NET Framework的正确版本(3.5)。

if you try to load it from the locations which are printed below, look for the System.Xml.Linq dll in 如果您尝试从下面打印的位置加载它,请在中查找System.Xml.Linq dll

C:/zennlnglib/System.Xml.Linq.DLL C:/zennlnglib/System.Xml.Linq.DLL

I guess 我猜

C:/Documents and Settings/Administrator/Desktop/NLNG.Encryption/NLNG.Encryption/bin/Debug/ C:/ Documents and Settings / Administrator / Desktop / NLNG.Encryption / NLNG.Encryption / bin / Debug /

does not exist at the target machine. 在目标机器上不存在。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM