Converting Visual Studio solutions to SCons

A python script to convert Microsoft Visual Studio 2005 solution files (*.sln) and the associated project files (*.vcproj) into a set of SCons files (SConstruct and SConscript).

This script is similar to my previous post Sln2Make but instead of generating Makefiles it creates SCons scripts. The class Sln2SCons does all the work, parses the sln and vcproj files and generates a main SConstruct and one SConscript for every project in the solution. To use it, just instantiate the class with the following parameters:

Sln2SCons(slnpath, exlist, dirrepl, librepl, outdir)


  • slnpath is the path to the solution file
  • exlist an optional list of files to exclude, optionally you can pass an alternative script name to be included from the main SConstruct: [[script_to_exclude, alt_script], …]
  • dirrepl a list of directory replacement rules
  • librepl library name replacement rules (when win library name doesn’t match OS’s library name)
  • outdir is the output directory for the SConstruct


# custom scripts
exlist = [('../extsrc/apr/SConscript', 'extsrc/apr/')]
# special directory replacement rules
dirrepl = []
# special library name replacement rules (when win library name doesn't match OS's library name)
librepl = []
Sln2SCons("../winnt/test.sln", exlist, dirrepl, librepl, "../")

To correct the path case, I’ve used a script published by Moshe Zadka here.
Use this code at your own risk, it is released under BSD license.

The source is in Google Code now, here is the link.

Leave a Reply

Your email address will not be published. Required fields are marked *