MSTSCLib.DLL BadImageFormatException,RDP控件无法在32位操作系统上运行 [英] MSTSCLib.DLL BadImageFormatException, RDP control not working on 32bit OS

查看:144
本文介绍了MSTSCLib.DLL BadImageFormatException,RDP控件无法在32位操作系统上运行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



在我的应用程序中(vs 2012)我使用 Microsoft RDP客户端控件(COM)远程连接到一台机器。它运行良好,除非我在32位操作系统上运行我的exe,然后抛出 BadImageFormatException



错误日志:

无法加载文件或程序集Interop.MSTSCLib或其依赖项之一。系统找不到指定的文件。



1-我尝试了不同版本的COM(Microsoft RDP Client Control版本2到10) ,加上微软终端服务客户端控制



2-我试图将目标平台设置为任何CPU,x86,x64



3-我试图嵌入库



我必须确保这个应用程序适用于64位和32位操作系统,任何想法? ?

Hi,
In my application (vs 2012) I'm using Microsoft RDP Client Control (COM) to connect remotely to a machine. It's working all well unless I run my exe on a 32bit OS, then BadImageFormatException is thrown!

Error log:
Could not load file or assembly Interop.MSTSCLib or one of its dependencies. The system cannot find the files specified.

1- I tried different versions of the COM (Microsoft RDP Client Control version 2 through 10), plus "Microsoft Terminal Services Client Control"

2- I tried to set the target platform to Any CPU, x86, x64

3- I tried to embed the library

I have to make sure this app works on both 64 and 32 bit OS, Any Ideas??

推荐答案

Microsoft RDP客户端控件是否为本机DLL?



如果您的.NET应用程序是为64位构建,您还需要包含64位本机库。同样,32位应用程序也是如此。虽然您的.NET程序可能是AnyCPU,甚至是32位,并且本机库不是正在运行的当前平台的正确架构,但您将获得 BadImageFormatException [ ^ ]。



目前为止我可以看到你有两个/三个选项,对于所有选项,你需要32位版本的 Microsoft RDP客户端控件库。

1)您将.NET程序编译为x86。它将是一个32位程序(在64位操作系统上完美运行)并且它将加载32位库。

2)您创建两个不同版本的.NET程序。一个64位,另一个32位。每个版本都会重新分发相应的库。

2a)您可以开始制作AnyCPU应用程序,但是,您需要动态加载适当的库。这是一个示例 [ ^ ]。



选项1可能是最容易做到的,除非你发现它真的很重要在64位操作系统上有64位版本的应用程序。
Is the Microsoft RDP Client Control a native DLL?

If your .NET application is built for 64-bit, you'll also need to include a 64-bit native library. Likewise, the same goes for a 32-bit application. While your .NET program might be AnyCPU, or even 32-bit, and the native library isn't the right architecture of the current platform it's running on, you'll get a BadImageFormatException[^].

As far as I can see you have two/three options here, and for all options you'll need the 32-bit version of the Microsoft RDP Client Control library.
1) You compile your .NET program as x86. It'll be a 32-bit program (which runs perfectly on a 64-bit OS) and it'll load the 32-bit library.
2) You create two different versions of your .NET program. One 64-bit, and the other 32-bit. And with each version you redistribute the appropriate library.
2a) You can go down the road of making an AnyCPU application, however, you'd need to dynamically load the appropriate library then. Here's an example[^] of that.

Option 1 is probably the easiest to do, unless you find it really important to have a 64-bit version of your application on a 64-bit OS.


我在这里找到了解决方案,在第二个答案中:

http://social.msdn.microsoft.com/Forums/en-US/5a92a204-81fe-4c6f-bfc3-ef04dc932ed0/could-not-load-file-or-assembly-interopactiveds-version1000-cultureneutral?forum= netfx64bit [ ^ ]



但是我所做的只是构建我的应用程序,目标CPU x86和复制的DLL我的exe的路径相同,一切运作良好:D
I found the solution here, in the second answer:
http://social.msdn.microsoft.com/Forums/en-US/5a92a204-81fe-4c6f-bfc3-ef04dc932ed0/could-not-load-file-or-assembly-interopactiveds-version1000-cultureneutral?forum=netfx64bit[^]

But all I did is built my app with target CPU x86 and copied DLLs within same path of my exe, and all worked well :D


这篇关于MSTSCLib.DLL BadImageFormatException,RDP控件无法在32位操作系统上运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆