C++ – Open source Visual Studio project distribution nightmare

ccompiler-constructionvisual c++visual studio

Every time Microsoft releases a new version of visual studio, they always require me to convert my solution and project files to 'the latest version.' Even with something as simple as a "Hello World" solution, I need to go through their conversion wizard!

And, to make things worse, the new visual studio solution files aren't compatible with old versions of visual studio.

What a nightmare for anyone working with a group of people…or anyone hoping to distribute the source code for their projects.

Is there any good way to distribute a visual studio project, and allowing people using older versions of visual studio to still use it? It's a simple C program, not using any nifty options. I only have access to Visual Studio 2008, and Visual Studio provides no backwards 'conversion' wizard. Would it make sense to release the source code using nmake+makefile to build the program? It seems the nmake file format hasn't changed significantly in some time, and would be possible to provide a makefile that works with a wider range of versions of visual studio.

Best Answer

The normal way to do this is to place the vs project files in a sub directories of the solution. Eg

solution
 - build
 -- vc6
 -- vc7
 -- vc8
 -project1
 -- src
 -- build
 --- vc6
 --- vc7
 --- vc8
 -project2
 -- src
 -- build
 --- vc6
 --- vc7
 --- vc8

Then when you get a new version of vs - copy the last project directory eg vc7 to vc8 - do the same for the solution - open the solution and project files in a text editor to fix any paths - finally open the solution in the new version of vs and let it convert your projects - (Use source control as if one or your paths are wrong it update a project in an old directory)

This is tiresome but you only have to do it every few years.

This is how we used to do it, but there is a better way however and that is to use CMake to generate your projects. We use this now in work and it allows use to use a single project definition to work natively on windows and unix. On windows we use vs projects on unix we use eclipse and makefiles. Also CMake allows you to abstract common project settings like compiler and linker flags, so they only have to be modified in one place.

I now use CMake for all c++ projects whether I require its multi platform capabilities or not.