Description of Visual Studio. NET "Target Platform"

Source: Internet
Author: User
Tags visual studio 2002

The Platform target is an often overlooked option in the build configuration for Visual Studio 2005 and 2008 projects.
"Generate"
Configuring,
"Goal
Platform "is an option that is often ignored.

For C # projects, you will find this option on the Project Properties dialog under the build tab.

For the C # project, you will
Under the Project Properties dialog box tab (
Build

) Solution
Find it.

For
VB.net projects, the setting is found on the advanced compiler settings
Dialog which is made available via the advanced compile options button
On the compile tab of the project properties.

For VB.net projects, you can
On the compilation tab of the project properties
Find the advanced compilation option in settings.

The list of available options are:

The list of available options is as follows:

  1. Any CPU
    Any CPU
  2. X86
    X86
  3. X64
    X64
  4. Itanium
    Anteng

The meaning of these options is often misunderstood.

The meaning of these options is often misunderstood.

Based on their names, one might think that the compiler will generate code differently based upon the setting.

According to their names, people may think that the compiler will
Set
Generate
Different codes.

However,
The C # and VB.net compilers only generate IL code that is taken
Native code by the CLR at runtime using the just-in-time compiler
(Unless ngen
Is used but that is another discussion ).

However, the C # And VB.net compilers only generate
It is used by CLR only during runtime.
Real-time compiler to generate local code
(Unless
Use

Ngen,
But that is another topic ).

The
Fact is that this setting actually does not affect the build of
Assembly in any way does t to set the platform status information on
Assembly's CLR header.

In fact, this setting does not actually affect the Assembly building,
Platform Status Information
Set to the CLR header.

In
Other words, the Platform Target setting is meant to communicate
Platform that the developer intends to be compatible.

In other words, the platform goal is set for communication.
Developers intend to be compatible
.

The default setting, Any CPU, means that the assembly will run natively on the CPU is it currently running on.

Default settings,
Any CPU (

Any CPU), meaning
Assembly
Set
Run
In
Running locally
CPU.

Meaning, it will run as 64-bit on a 64-bit machine and 32-bit on a 32-bit machine.

That is, it runs 64-bit on a 64-bit computer and 32-bit on a 32-bit computer.

If the assembly is called from a 64-bit application, it will perform as a 64-bit assembly and so on.

If the Assembly is called from a 64-bit application, it uses a 64-bit assembly
Run
.

If the project is set to x86, this means the project is intended to run only as a 32-bit process.

If the project is set to X86, this means that the project aims to run only one 32-bit process.

A 64-bit process will be unable to call into an assembly set as X86.

A 64-bit process cannot be called
Assembly
.

Reasons
To set your project as x86 include dependencies upon native DLLs that
Are only available in 32-bit or making native callassuming 32-bit.

If your project has a dependency on an unmanaged dll, only 32-bit or
Make
32-bit local call local DLL
Of
Hypothesis
.

Applications and assemblies marked for x86 can still run on 64-bit Windows.

Mark
X86
Applications and components can still run on 64-bit Windows.

However they run under WOW64
.

However, they run on WOW64

Lower
.

Visual Studio itself runs under this emulation mode since it is a 32-bit application.

Visual Studio runs on
Analog mode
Because it is a 32-bit application.

Setting the project to x64 will specify that the assembly must run under 64-bit Windows.

Set
X64 projects must run on 64-bit Windows.

Attempting to run the assembly on 32-bit Windows or call the assembly from a 32-bit process will result in a runtime error.

Try to run on a 32-bit Windows component or from a 32-bit Process
Call
The Assembly will cause a running error.

The final, and likely least common, setting is Itanium.

Finally, it may be least commonly used. Set itanium.

This setting specifies that the assembly will only run on an Itanium processor.

This setting specifies,
Assembly
It will only run on the Itanium processor.

The
Only reason to set your project for Itanium is if it has dependencies
On native DLLs compiled specifically for the Itanium processor.

Project
Set
Itanium

The only reason is the dependency on native DLL compiled as the Itanium processor.

Developers
Shocould be aware that simply marking Platform Target of an assembly
Any CPU does not guarantee that it will run on both 32-bit and 64-bit
Windows.

Developers should know that simply put an assembly
Of
Target
Platform
Identifier
Is
Any CPU,

It cannot be ensured that it can run on 32-bit and 64-bit Windows.

In
Fact, since Any CPU is the default setting, there are likely available
Applications that actually depend upon 32-bit processing but are not
Marked as such.

In fact, because
Any CPU

It is the default setting, and many applications may actually rely on 32-bit processes, but are not marked
32-bit

.

These
Assemblies will fail under 64-bit Windows when run from a 64-bit
Process so it is important to perform testing for your applications
Before users are migrated to 64-bit.

These components
Set
In 64-bit Windows
On
An error occurred while running a 64-bit process.
, So
Before the user is migrated to the 64-bit
Platform Testing for your application
Yes
Important
.

The somewhat increasing popularity of Vista x64 will soon elevate the importance of this type of testing.

With the increasing popularity of Vista X64, the importance of this type of test
It will be improved soon
.

Another
Point to be aware of when attempting to migrate to 64-bit processing
For. Net applications is the dependency upon assemblies originally built
Using Visual Studio 2002 and 2003.

Another thing to know is that when you want to try migration
Originally, Visual Studio 2002 and 2003 were used.
Component development
. . NET program to a 64-bit processor.

All
Assemblies targeting. Net 1.0 and 1.1 will be 32-bit only (x86) so
These assemblies will need to be upgraded to newer versions, if
Available, or the functionality will need to be replaced in order
The process to execute as 64-bit.
All based on 1.0 and 1.1
Assembly
It will be 32-bit (X86), so these components will need to be upgraded to the available new version, or the function will need to be replaced to execute this process as 64. -Bit.

Here are some excellent links on MSDN that shoshould be required reading before migrating a complex project to 64-bit Windows:

The following are some suggestions on MSDN:
In
Migration
A complex project is 64-bit Windows
Excellent links for reading earlier:

Visual Studio 64-bit applications

Migrating 32-bit managed code to 64-bit

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.