Debugging 64-bit applications using Visual Studio 2005

FAQ of 64-bit and Visual Studio 2005

[http://blogs.msdn.com/deeptanshuv/archive/2006/04/11/573795.aspx]

64-bit and Visual Studio 2005

We keep receiving questions about Visual Studio 2005's support for 64-bit.  Here is a set of factoids that should help answer the most commonly enquired issues:

(a) There are two flavours of 64-bit - AMD64 or X64, and IA64.  Windows 64-bit installs on both architectures.

(b) There is no 64-bit version of VS. Visual Studio 2005 is available only as a 32-bit app.  However, you CAN install VS on a 64-bit OS and use it to create, launch and debug 64-bit apps. 

(c) VS will install only on X64.  The .Net Framework and the Debugger components install on IA64, allowing you to remotely launch and debug applications on IA64 from a VS IDE installed on another machine.

(d) VS installed on either 32-bit or 64-bit OS can create 32-bit or 64-bit applications, but of course the applications need the corresponding platform to execute.

(e) You need the Professional or Team System versions to build X64 (AMD64) apps. 

(f) You need Team System to build IA64 apps. Pro does not support this. See http://msdn2.microsoft.com/en-us/library/hs24szh9(VS.80).aspx

(g) On a 32-bit OS, the 64-bit compilers will not be installed by default, you will need to go to custom setup and check the option.

How to create 64-bit apps

A managed project is automatically built according to the architecture selected => default C# project created on AMD64 will be AMD64, X86 on X86.  The native one is always 32-bit by default.

To explicitly set a platform:

(1) open the solution explorer, select solution, right click->Configuration Manager.
(2) go to 'Active Solution Platform', click New.
(3) in the 'New Solution Platform' dialog that comes up select the new platform say Itanium. Set 'Copy Settings From' to 'Any CPU' which was the default setting in the 'Active Solution Platform'.
(4) click OK.

You will see that the platform has changed to Itanium in the config manager.  Now when you build the  solution, you will get an Itanium exe.

Follow the same process for X64, and to rebuild 32-bit apps from that solution.

 

Debugging 64-bit applications using Visual Studio 2005

 A short note on this issue that I came across recently. Let’s say we are trying to debug a managed/unmanaged code in Visual Studio 2005 in a 64-bit machine. We complete the code and hit F5 (debug the application), and land up with the following error:

Error while trying to run project: Unable to start debugging.
The components for the 64-bit debugger are not registered. Please repair your Visual Studio 2005 Remote Debugger installation via 'Add or Remove Programs' in Control Panel.

Okay all that we are doing is debugging an application in the local machine. So why should there be a problem with the remote debugger installation?

Here is some background on how debugging works in 64-bit environment that explains why you see this error message.
Even on a 64-bit machine, Visual Studio runs as a 32-bit application. This means that Visual Studio would run in the Windows-on-Windows (WoW64) layer. It would not be possible to attach a 32-bit debugger to a 64-bit process. However, if you want to debug a 64-bit application, there is something special that Visual Studio does to make this possible. We would achieve this pseudo-remotely. You are running the debugger on the same machine as the process but debugging is done through the remote debugger. All this happens behind the scenes and you as a developer would not need to do anything special.

Now, if you are seeing this error on a 64-bit machine, I would assume that the remote debugging components were not included during the Visual Studio installation process. All that we would need to do is install the remote debugging components.

 

MSDN official note:

When you run Visual Studio 2005 under WOW mode to debug a 64-bit application on the same machine, Visual Studio 2005 appears to be doing normal local debugging. However, Visual Studio 2005 is actually using the remote debugging mechanism to connect from WOW to the 64-bit application. Therefore, all considerations that apply to remote debugging also apply to local debugging on a 64-bit platform.

 

你可能感兴趣的:(application)