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

查看:26
本文介绍了发布不起作用,将 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:

在 app.config 中添加startup useLegacyV2RuntimeActivationPolicy="true""并将目标框架从.NetFW4.0 client"更改为.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.我不知疲倦地在谷歌和其他网站上搜索无济于事,确实找到了 1 个有相同错误的人,没有人可以回答,其他一些发现不适用于这种情况,因为仍然无法正常工作.任何人都可以请这么好心,对此事有所了解吗?

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?

提前致谢

我运行了 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:WindowsWinSxSmanifestsx86_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:WindowsassemblyGAC_32Microsoft.VC80.CRT8.0.50727.6195__1fc8b3b9a1e18e3bMicrosoft.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.

推荐答案

现在:我生成可执行文件并将其移动到测试 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:

有两个潜在的问题.

  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天全站免登陆