To the command line enthusiasts: Some quick know-hows for Upgrading to VS 2010

Visual CPP Team

Hello, I am Renin John, a Software Development Engineer in Test from the VC++ Project and Build team. I am aware that some of you prefer to do your daily work from the command prompt rather than from the IDE. I thought it would help if I put together instructions for the same using the knowledge I acquired testing Project Conversion.


In order to perform an upgrade from a prior version of Visual Studio (VC6 through VS 2008) through the command line, you could use one of the following tools:


1.       devenv.exe

2.       VCUpgrade.exe


They’ll come in handy even if you’re thinking of scripting the conversion process.


1.       DevEnv.exe:


Like in the previous versions, you could upgrade using the devenv.exe command: just invoke it with the “/upgrade” switch. The location of devenv.exe is specified by the DevEnvDir environment variable in the VS 2010 command prompt window.


Command:            a) To upgrade solution file: devenv.exe /upgrade <solution file (.sln)>; or

                              b) To upgrade project file: devenv.exe /upgrade <project file (.vcproj)>


This command will generate a log file named UpgradeLog.XML (UpgradeLog2.XML if UpgradeLog.XML already exists, UpgradeLog<n+1> if UpgradeLog<n> already exists, where n=2,3,…) at the end of conversion, that will contain the detailed list of errors/warnings from the conversion of the solution/project files.



i)  Conversion on the command line using devenv.exe is not supported for VC6.

ii) Since the devenv.exe command is not available in the VC Express SKU, this form of conversion is not applicable here.

Hence for the above two cases, you would need to stick to the VS IDE. However, if it’s for a single project file, you have the option of using VCUpgrade.exe (described below).


2.       VCUpgrade.exe


This is a new tool introduced in VS 2010. It is located in the directory specified by the VS100COMNTOOLS environment variable in the VS 2010 command prompt window.


It is going to be included in the next release of WinSDK, so the users will be able to convert their SDK based samples even if they do not have devenv.exe or rather, Visual Studio installed.


Command: vcupgrade.exe <project file (.dsp/.vcproj)>


The conversion results will be displayed in the command window once the conversion is complete.


If you are re-converting your project file, invoke VCUpgrade with the “/overwrite” switch, otherwise the existing files will not be replaced.


Note: This tool has some limitations and cannot be used to convert solution files. It is recommended only for single project files: those which do not contain project to project references, and whose solution files do not contain project dependencies as this information from the solution will be lost during conversion (This is because, in VS 2010, solution dependencies are converted into project-to-project references). Use the devenv.exe tool (explained earlier) instead in these other cases, which is generally more preferred over VCUpgrade.


Reversing the upgrade:


a)      If you did a solution file upgrade:

Go to the directory containing the solution and run:

del /S *.vcxproj* *.props

del *.sln UpgradeLog*.XML

move Backup*.sln .

for /F %B in (‘dir /B Backup*’) do rd /S /Q %B

rd /S /Q _UpgradeReport_Files


b)      If you did a project file upgrade:

Go to the directory containing the project file and run:

del /S *.vcxproj* *.props

del UpgradeLog*.XML

rd /S /Q _UpgradeReport_Files


You could just throw these commands into a batch file and let it take care of this for you (Replace %B above with %%B if in the batch script).

Note: If the directory containing the particular solution/project contains other solution/project files that you do not want to have deleted, please modify the commands accordingly. Also, if your project uses “.props” files located somewhere outside this directory, take care to delete those files as well.


Hope you enjoyed this blog. Do let me know if you have any questions/comments.



Discussion is closed.

Feedback usabilla icon