开发者

Identifying target machine (32 bit or 64 bit) with ClickOnce deployment

I have a Windows Forms application and am deploying that application through ClickOnce deployment. Now, I've a third-party DLL file and it has different versions for 32-bit and 64-bit OS.

Is it possible to deploy different DLL 开发者_开发技巧files based on the target machine (32-bit or 64-bit) through ClickOnce?


[Edit]

It's not necessary to use reflection. You can add a reference to your program directly in the loader and kick it off. Did a blog post with code about it at Tech and Me.


You could include both versions in your deployment, but name them differently. Then have a loader app check if you are on a 32bit or 64bit system, copy the correct dll (eg thirdparty64.dll -> thirdparty.dll) which your real program is linked to, and then invoke your program from the loader with for example Assembly.Load and use reflection to start your main method.

An easier method is to compile your application to run as x86, ensuring it will always run in 32bit mode. If you don´t rely on some specific application being installed on the machine in 32/64bit versions this could be the best choice.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜