1
votes

Does devenv through any switch or any tool allow to convert a Visual Studio Project and Solution from x86 to X64/AMD64? I was particularly thrilled with the switch /Upgrade in devenv which automatically upgrades a solution/project from previous version to the current version and was looking forward for something similar to do a bitness conversion.

I have a set of vcxproj that I want to port from 32 bit and 64 bit. The process I understand should be straight forward as it only have to create a new configuration for x64, copy the settings for both Win32 Debug/Release and then do a blind replace of all the CRT/MFC libraries/dlls and toggle few switches to make it a 64 bit build.

Hacking through the vcxproj and sln files may be an option but I do not want to invest time and reinvent the wheel if one already exist.

Note If it matter's, currently my focus is only for Visual Studio 2010.

2

2 Answers

1
votes

You don't need to "upgrade" your Project files from Win32 to x64. Just go into configuration manager for your solution and add an x64 platform for the project configurations that need it.

1
votes

I wrote a python script to do it manually, kinda hacky but it seems to work :)

Pretty straight forward since both the solution and project files are plain text. At first I did it via configuration manager, then I diffed the files and did the same procedure in python.

In my case (protobuf 2) it was only a few 'replace all's.

  • in both sln and project replace Win32 with x64
  • in project replace

    <TargetMachine>MachineX86</TargetMachine>
    

    with

    <TargetMachine>MachineX64</TargetMachine>
    
  • and

    <DebugInformationFormat>EditAndContinue</DebugInformationFormat> 
    

    with

    <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
    
  • and finally change the OutDir so my cmake Find scripts pickup the build

Full source https://github.com/madeso/ride/blob/f7d7234972aeaa0ddb89cda030ecfe651678078d/scripts/windows.py#L163