[.net] Compile target visual c# express

Started by
4 comments, last by barakus 18 years, 10 months ago
How do I change the target processor of an application on visual c# express?
Advertisement
The beauty of .NET is that you don't have to worry about that.

When you compile source code into an executable, it isn't compiled into native language. Instead, it is compiled into Microsoft Intermediate Language (MSIL). Check it out by opening up your executable in a hex editor. Note that you can actually read your code!

When the application is run, it is just-in-time (JIT) compiled and stored into cache, more or less. During this step, the MSIL is compiled to native language, and .NET knows all the optimizations for the target processor. Therefore, your application will run optimally on any processor! Java works the same way (sort of).

This obviously offers an advantage over traditonally compiled languages, like unmanaged Cpp, but it also introduces some security issues. I guess that's another topic altogether, though. :D

HTH!
~del
The project options will allow you to target a specific platform (64 bit or 32 bit).

In time the project grows, the ignorance of its devs it shows, with many a convoluted function, it plunges into deep compunction, the price of failure is high, Washu's mirth is nigh.

The only reason you'll need to specify a target platform is when you've made assumptions about the platform in your code (like casting IntPtr to Int32 or something like that). If you leave it on the default of "Any CPU" then it'll be compiled at runtime to 32- or 64-bit, depending on the platform.
I cant find the option on express. Im running windows xp64, and when i run the application i get a badimageformatexception, which im pretty sure is because im running a 64 bit application that links to 32 bit dll's. Maybe i could put a command on the pre-build event command line that specifies the target platform? How would i do that?
Never mind i found it. Had to go to the solution properties.

This topic is closed to new replies.

Advertisement