如何创建安装程序以同时运行x86或x64平台 [英] How to create setup to run both platform x86 or x64

查看:115
本文介绍了如何创建安装程序以同时运行x86或x64平台的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

先生,我尝试创建一个集来同时运行两个平台,但是当我在x64中运行集时,则会显示一条错误消息.....

请帮助我..

sir i try to create set to run both platform but when i run my set up in x64 then one error message show .....

Plz help me..

推荐答案

在最简单的情况下,您不需要为此做任何特别的事情.确保为目标任何CPU"构建了所有程序集.由于.NET是JIT编译的系统,因此所有指令集体系结构的组装模块都是相同的.在这种情况下,将在运行时自动定义运行应用程序时执行的本机代码,具体取决于计算机的指令集体系结构.请参阅:
http://en.wikipedia.org/wiki/Instruction_set_architecture [ http://en.wikipedia.org/wiki/Just-in-time_compilation [ ^ ].

如果一个或多个程序集使用为某些特定指令集体系结构编译的本机代码,情况可能会变得更加复杂.然后,目标CPU架构应与此代码匹配.首先要了解的是:您不能在一个过程中混合使用不同的指令集架构.更糟糕的是,它将编译但在运行时崩溃.

另外,您可以使用以下原则:如果所有程序集都编译为"Any CPU",并且只有入口点程序集(启动应用程序时加载的程序集)具有特定(非"any")目标,它将定义整个过程的指令集架构.您可以将其用作针对不同机器实现不同版本的方法.

我不想概述目标指令集体系结构的所有可能组合.您应该使用一般原则.我只描述两个典型的案例.

首先,如果可以使用32位目标,则可以在任何计算机上使用它. 32位CPU与两种64位指令集体系结构都兼容,但是两个64位CPU彼此不兼容.因此,32位是最通用的变体,当然,您的非托管部分都是32位的.当然,所有任何CPU"的情况都更为普遍,但是话又说回来,只有在不使用非托管代码的情况下,它才可以工作,或者您可以为每种情况使用所有非托管模块的版本,并在安装期间部署适当的版本.

我刚刚提到的变体是另一种.想象一下,您拥有所有指令集体系结构的非托管代码版本.然后,您应该安装适当的模块并使用通用CLI代码.

—SA
In the simplest case, you don''t need to do anything special for that. Make sure all assemblies are built for the target "Any CPU". As .NET is JIT-compiled system, the assembly modules for all instruction-set architectures will be identical. In this case, the native code executing when you run the application will be defined during run-time automatically, depending on the instruction-set architecture of the machine. Please see:
http://en.wikipedia.org/wiki/Instruction_set_architecture[^],
http://en.wikipedia.org/wiki/Just-in-time_compilation[^].

The situation can become way more complex if one or more of the assemblies uses some native code compiled for certain particular instruction-set architecture. Then the target CPU architecture should match this code. First thing to understand is: you cannot mix different instruction-set architectures in one process. Worse, it will compile but crash during run time.

Also, you can use the following principle: if all assemblies are compiled as "Any CPU", and only the entry-point assembly (the one loaded when you start application) has certain (non-"any") target, it will define the instruction-set architecture of the whole process. You can use it as the method of implementation different version for different machines.

I don''t want to overview all possible combination of target instruction-set architectures. You should use general principles. I''ll just describe two typical cases.

First, if you can use 32-bit target, you can use it on any machine. The 32-bit CPU is compatible with both 64-bit instruction-set architectures, but two 64-bit ones are not compatible with each other. So, 32 bit is the most universal variant, it your unmanaged parts are all 32-bit, of course. And of course all "Any CPU" is even more universal case, but then again, it would work only if you don''t use unmanaged code, or you can have versions of all unmanaged modules for every case and deploy appropriate version during installation.

The variant I just mentioned is another one. Imagine, you have a version of unmanaged code of all instruction-set architectures. Then you should install appropriate modules and use universal CLI code.

—SA


这篇关于如何创建安装程序以同时运行x86或x64平台的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆