发布不起作用,将FW 2.0 dll引用到FW 4.0 Winform中 [英] Release not working, referencing FW 2.0 dll into FW 4.0 winform

查看:103
本文介绍了发布不起作用,将FW 2.0 dll引用到FW 4.0 Winform中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

随着跟踪,这意味着我需要使语言环境中立,以便引用的dll工作。关于如何设置它的任何想法?还是您将中性设置为某些东西?

With the trace it implies that i need to make the locale neutral, in order for the referenced dll to work. Any idea on how to set it? or you set the neutral as something?

我编写了一个测试程序。我正在Windows窗体中使用VS2010,VB.net,.Net Framework 4.0。这是一个本地测试应用程序,仅需最低工作量(由几个标签和几个按钮组成)。
我得到了一个在.net framework 2.0中制作的.dll。所以我引用了它。没用因此,我搜索了该解决方案,发现它与其他解决方案有点不同,因为我必须做两件事才能使其起作用:

I made a test program. I'm using VS2010, VB.net, .Net Framework 4.0, in Windows forms. It's a local test app with the bare minimum to work(form with couple of labels and a couple of buttons). I was given a .dll that was made in .net framework 2.0. So I referenced it. It didn't work. So I searched for the solution and found that it was a bit different from the other since I had to do 2 things in order for it to work:

添加 startup useLegacyV2RuntimeActivationPolicy在app.config中将= true并将目标框架从 .NetFW4.0客户端更改为 .NetFW4.0。这使得它可以在我的开发PC中工作。调试并通过VStudio或.exe正常工作。

Add "startup useLegacyV2RuntimeActivationPolicy="true"" in the app.config AND change the target framework from ".NetFW4.0 client" to ".NetFW4.0". That made it work in my Developing PC. Debugs and works properly via VStudio or .exe.

现在:我生成可执行文件并将其移至测试PC,但它不起作用。该程序只是不会加载。我的意思是,它永远不会到达负载手柄,而是会闭合。经过一些调整以测试消息后出现:

Now: I generate the executable and move it to test PC and it doesnt work. the program just wont load. By this I mean it never reaches the load handle and just closes. After some tweaking around for testing a message came up:

无法加载文件或程序集 banortepinpad.dll或其依赖项之一。
应用程序无法启动,因为它的并行配置不正确。请查看应用程序事件日志或使用命令行sxstrace.exe工具以获取更多详细信息。 (来自HRESULT的异常:0x800736B1)

Could not load file or assembly 'banortepinpad.dll' or one of its dependencies. The application has failed to start because it's side-by-side configuration is incorrect. Please see the application event log or use the command-line sxstrace.exe tool for more detail. (Exception from HRESULT: 0x800736B1)

我确实在文件夹中包含dll。香港专业教育学院孜孜不倦地在谷歌和其他网站上搜索无济于事,没有找到一个人有同样的错误并且没有人可以回答,另外一些发现不适用于这种情况,因为它仍然无法正常工作。任何人都可以这么仁慈,并对此事有所了解吗?

I do have the dll inside the folder. Ive searched tirelessly on google and other sites to no avail, did find 1 guy that had the same eror and noone could answer, some other finds dont apply to this case since is still not working. Could anyone please be so kind and shed some light on the matter?

在此先感谢

编辑:Ive运行sxstrace并发现以下内容:

Ive run the sxstrace and found this:

=================
Start Activation context generation .
Input parameter :
Flags = 0
ProcessorArchitecture = x86
CultureFallBacks = es-ES , is
ManifestPath = C : \ Banorte \ BanortePinPad.dll
AssemblyDirectory = C : \ Banorte \
Application Config File =
-----------------
INFO: analyzing manifest file C : \ Banorte \ BanortePinPad.dll .
INFORMATION : defining the identity of the manifesto is (null ) .
INFO: Reference :Microsoft.VC80.CRT,processorArchitecture="x86",publicKeyToken="1fc8b3b9a1e18e3b",type="win32",version="8.0.50727.6195"
INFO: Reference :Microsoft.VC80.CRT,processorArchitecture="x86",publicKeyToken="1fc8b3b9a1e18e3b",type="win32",version="8.0.50608.0"
INFORMATION : resolving reference Microsoft.VC80.CRT,processorArchitecture="x86",publicKeyToken="1fc8b3b9a1e18e3b",type="win32",version="8.0.50727.6195".
INFO: x86 solving ProcessorArchitecture reference .
INFORMATION : solving Neutral culture .
INFORMATION : binding policy applied .
INFO : Find publisher policy at C:\Windows\WinSxS\manifests\x86_policy.8.0.microsoft.vc80.crt_1fc8b3b9a1e18e3b_8.0.50727.4940_none_516d712b0f495a45.manifest
INFO: not found redirection binding policy .
INFO: start assembly poll .
INFORMATION : Could not find the assembly in WinSxS .
INFO : Attempt to probe manifest at C:\Windows\assembly\GAC_32\Microsoft.VC80.CRT\8.0.50727.6195__1fc8b3b9a1e18e3b\Microsoft.VC80.CRT.DLL.
INFO : Attempt to probe manifest at C: \ Banorte \ Microsoft.VC80.CRT.DLL .
INFO : Attempt to probe manifest at C: \ Banorte \ Microsoft.VC80.CRT.manifest .
INFO : Attempt to probe manifest at C: \ Banorte \ Microsoft.VC80.CRT \ Microsoft.VC80.CRT.DLL .
INFO : Attempt to probe manifest at C: \ Banorte \ Microsoft.VC80.CRT \         Microsoft.VC80.CRT.manifest .
INFORMATION : Could not find the manifest of the culture Neutral .
INFORMATION : complete assembly poll .
ERROR : can not resolve the reference
ERROR: Activation context generation .
Finish Activation context generation .

这里是我的app.exe.config内容:

Heres my app.exe.config contents:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
    <startup useLegacyV2RuntimeActivationPolicy="true">
        <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0" />
    </startup>
</configuration>

该跟踪是我在编辑和修复app.exe.config之后得到的,如上所示

That trace is what I got after editing and fixing the app.exe.config, as is shown above.

这是否意味着我需要程序集的清单才能起作用?

Does it imply that I need the manifest of the assembly in order for it to work?

我仍然没有找到方法。我已经检查了程序集,并在目标pc上安装了可再发行的vc ++。有人知道我的安装程序包含VSMC80库吗?

I still havent found the way to do it. I ve already checked the assembly and installed the vc++ reditributable on target pc. does anyone know i the installer contains VSMC80 library?

有人对可能发生的事情有任何其他想法吗?

Anyone got any other ideas of what might be happening? Any input would be more than apreciatted.

推荐答案


现在:我生成可执行文件并将其移至测试电脑,它不起作用。该程序只是不会加载。我的意思是,它永远不会到达负载手柄,而是会闭合。经过一些测试消息的调整之后:

Now: I generate the executable and move it to test PC and it doesnt work. the program just wont load. By this I mean it never reaches the load handle and just closes. After some tweaking around for testing a message came up:

存在两个潜在的问题。


  1. 确保在部署计算机上部署 app.Config 。这将是一个名为 YourApplication.exe.config 的文件,并且需要位于.exe文件旁边。这就是在部署时正确设置运行时策略的原因。

  1. Make sure you deploy your app.Config on the deployment machine. This will be a file named YourApplication.exe.config, and needs to be next to the .exe file. This is what sets the runtime policy properly at deployment.

由于使用的是混合模式程序集,因此请确保目标是正确的CPU体系结构。如果您的系统位于x86上,且部署为x64,并且您的应用程序针对AnyCPU,则混合模式程序集将无法加载。将其设置为显式使用x86即可解决此问题。

Make sure you're targeting the proper CPU architecture, since you're using a mixed mode assembly. If your system in x86, and the deployment is x64, and your app targets AnyCPU, then the mixed mode assembly will fail to load. Setting it to explicitly use x86 will correct this.

确保混合模式程序集使用的任何本机DLL在目标系统上也可用。这通常包括安装适当的VC ++运行时。

Make sure that any native DLLs the mixed mode assembly uses are also available on the target system. This often includes installing the proper VC++ runtime.

这篇关于发布不起作用,将FW 2.0 dll引用到FW 4.0 Winform中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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