in reply to Converting .NET .sln files to nmake/nant format
First off, you should target your efforts towards the '.vcproj' files - as they are holding the actual files in the project. Refer to Microsoft for the full XML schema. (Hey, they actually documented this!).
Then use XML::Simple or whatever our preference is to parse, rinse, stir and output to a nmake/gmake/whatnot file.
The '.sln' file is not XML, but a pretty straight-forward text-file, most notably linking to the '.vcproj' files.
I haven't converted in this direction, but rather generated .vcproj files from other input.
Following code should get you started (assumes '.sln' file(s) as args):
use strict; use warnings; use XML::Simple; use Data::Dumper; my(%projs); while(<>) { # Extract project files linked into solution if(/^Project\(.+\)\s+=\s+\"([^"]+)\",\s+\"([^"]+)\"/) { $projs{$1} = $2; # Got one! } } # Process the project files - XML format my $xs = new XML::Simple(); for my $p (keys(%projs)) { my $file = $projs{$p}; print "Parsing $p, file $file\n"; my $ref = $xs->XMLin($file); # Print parsed XML - or output in another format? print Dumper($ref); }
Cheers,
---Lars
Update: Added code snippet
|
|---|