简体   繁体   中英

Creating single winform setup to run both on 32 bit and 64 bit machine

I want to create single window application setup that can be installed both on 32 bit as well as on 64 bit machine. I have few dlls that can be used according to DLL version only ie A.dll(32bit), A.dll(64bit).

If software is being installed on 32 bit machine, all 32bit dlls should be used otherwise other.

Now I can create two different setups by building project twice. However I want to have just one setup that will take care automatically.

I have gone through this link which seems to be what I am looking for however it's based on the product they are selling not default windows setup creation wizard.

I found a duplicate question here with no answer.

add dll import code

[DllImport("MyDll32.dll", EntryPoint = "Func1", CallingConvention = CallingConvention.Cdecl)]
private static extern int Func1_32(int var1, int var2);

[DllImport("MyDll64.dll", EntryPoint = "Func1", CallingConvention = CallingConvention.Cdecl)]
private static extern int Func1_64(int var1, int var2);

public static int Func1(int var1, int var2) {
    return IntPtr.Size == 8 /* 64bit */ ? Func1_64(var1, var2) : Func1_32(var1, var2);
}

solution explorer --> Double click Properties (A new tab should open up) --> build tab

Setting configurations--->options( Any CPU, x32bit, x64bit)---> to 'Any CPU' ensures that your application will work on both 32 and 64bit computers.

在此处输入图片说明

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM