Megosztás a következőn keresztül:


/platform (Visual Basic)

Specifies which platform version of common language runtime (CLR) can run the output file.

/platform:{ x86 | x64 | Itanium | anycpu }

Arguments

Term

Definition

anycpu

Compiles your assembly to run on any platform. This is the default behavior when the /platform option is not specified.

x86

Compiles your assembly to be run by the 32-bit, x86-compatible CLR.

x64

Compiles your assembly to be run by the 64-bit CLR on a computer that supports the AMD64 or EM64T instruction set.

Itanium

Compiles your assembly to be run by the 64-bit CLR on a computer with an Itanium processor.

Remarks

Use the /platform option to specify the type of processor targeted by the output file.

In general, .NET Framework assemblies written in Visual Basic will run the same regardless of the platform. However, there are some cases that behave differently on different platforms. These common cases are:

  • Structures that contain members that change size depending on the platform, such as any pointer type.

  • Pointer arithmetic that includes constant sizes.

  • Incorrect platform invoke or COM declarations that use Integer for handles instead of IntPtr.

  • Casting IntPtr to Integer.

  • Using platform invoke or COM interop with components that do not exist on all platforms.

The /platform option will mitigate some issues if you know you have made assumptions about the architecture your code will run on. Specifically:

  • If you decide to target a 64-bit platform, and the application is run on a 32-bit machine, the error message comes much earlier and is more targeted at the problem than the error that occurs without using this switch.

  • If you set the 32-bit option on the switch and the application is subsequently run on a 64-bit machine, it will run in the WOW subsystem instead of running natively.

On a 64-bit Windows operating system:

  • Assemblies compiled with /platform:x86 will execute on the 32-bit CLR running under WOW64.

  • Executables compiled with the /platform:anycpu will execute on the 64-bit CLR.

  • A DLL compiled with the /platform:anycpu will execute on the same CLR as the process into which it loaded.

For more information on developing an application to run on a Windows 64-bit operating system, see 64-bit Applications.

To set /nowarn in the Visual Studio integrated development environment

  1. Have a project selected in Solution Explorer. On the Project menu, click Properties. For more information, see Introduction to the Project Designer.

  2. Click the Compile tab.

  3. Click the Advanced Compile Options button.

  4. Modify the value of the Target CPU combo box.

Example

The following example illustrates how to use /platform option.

vbc /platform:x86 myFile.vb

See Also

Reference

Sample Compilation Command Lines (Visual Basic)

Other Resources

Visual Basic Command-Line Compiler