Release not working, referencing FW 2.0 dll into FW 4.0 winform

1

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?

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:

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.

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:

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)

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?

Thanks in advance

EDIT: 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 .

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>

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?

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.

vb.net
winforms
.net-assembly
side-by-side
asked on Stack Overflow Aug 30, 2013 by user2532535 • edited Sep 2, 2013 by user2532535

1 Answer

0

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:

There are two potential issues.

  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.

  2. 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.

  3. 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.

answered on Stack Overflow Aug 30, 2013 by Reed Copsey • edited Aug 30, 2013 by Reed Copsey

User contributions licensed under CC BY-SA 3.0