4
Vote

Multiplatform binaries(x86+x64)

description

In Javascript .NET binaries I see two different versions (x86 and x64), but I need one dll for both platforms, because my project can be deployed on any. Is it possible to get it?
Thanks

comments

shellscape wrote Jan 15, 2013 at 5:53 PM

You'll want to setup your project so that either can be referenced at run-time at the target platform.

First, right click on the reference to Neosis.Javascript and choose Properties. Change CopyLocal to false.

Second, create an 'Extenal' directory in your project root, along with an 'x86' and 'x64' directory, within the 'External' directory. Add the x86 files for Javascript.NET to the x86 directory, and make sure you select 'Add as Link' (there's an arrow on the right side of the 'Add' button in the Add Files dialog). Repeat for the 64 bit files, and link them into the x64 directory.

Next, you'll want to tell your app where it can find the files at run time. Put this in the startup routine for your app, before any other code is executed:
if (IntPtr.Size > 4) {
    AppDomain.CurrentDomain.AppendPrivatePath(@".\External\x64");
}
else {
    AppDomain.CurrentDomain.AppendPrivatePath(@".\External\x86");
}
Your app will now look in the appropriate directory for Javascript.NET at runtime.

wrote Feb 21, 2013 at 11:54 PM

wrote Aug 10, 2013 at 10:10 PM

wrote Oct 23, 2013 at 11:26 AM

hc4 wrote Mar 10, 2015 at 4:44 PM

The bad thing is that, x64 version of assembly is signed and x86 version is not signed.
So they have different metadata and can't be loaded dynamicaly in such way.

It will be great, if in executable package they both will be signed or unsigned.