Visual Studio .NET Solution File Format

Started by
3 comments, last by Origin 21 years, 9 months ago
Those of you who have already worked with Visual Studio .NET know that Microsoft changed again their project file formats. While Visual C++ 6.0 needed a workspace file (.dsw) and one or more project files (.dsp), Visual C++ 7.0 .NET needs a solution file (.sln) and one or more VC project files (.vcproj). To be able to convert between the different formats or to create them on the fly, I need to know how the new solution file is structured. Here are the contents of a basic .sln file with one associated project:

Microsoft Visual Studio Solution File, Format Version 7.00
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Test", "Test.vcproj", "{A4536DB2-D21D-40A9-8CC1-15F295177EBC}"
EndProject
Global
	GlobalSection(SolutionConfiguration) = preSolution
		ConfigName.0 = Debug
		ConfigName.1 = Release
	EndGlobalSection
	GlobalSection(ProjectDependencies) = postSolution
	EndGlobalSection
	GlobalSection(ProjectConfiguration) = postSolution
		{A4536DB2-D21D-40A9-8CC1-15F295177EBC}.Debug.ActiveCfg = Debug|Win32
		{A4536DB2-D21D-40A9-8CC1-15F295177EBC}.Debug.Build.0 = Debug|Win32
		{A4536DB2-D21D-40A9-8CC1-15F295177EBC}.Release.ActiveCfg = Release|Win32
		{A4536DB2-D21D-40A9-8CC1-15F295177EBC}.Release.Build.0 = Release|Win32
	EndGlobalSection
	GlobalSection(ExtensibilityGlobals) = postSolution
	EndGlobalSection
	GlobalSection(ExtensibilityAddIns) = postSolution
	EndGlobalSection
EndGlobal   
The format is pretty straightforward. I'm just wondering what the function of the two GUIDs is. The first GUID (8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942) seems to be the same for all solution files I create with VC.NET. Do you get the same GUID? And do you know what its purpose is? The second GUID (A4536DB2-D21D-40A9-8CC1-15F295177EBC in this case) varies from solution to solution (or rather project to project). Is this just a random GUID to uniquely identify a project? When creating .sln files on the fly, may I use CoCreateGUID() or a similar function to create that GUID? By the way: If anybody knows of the exact file format specifications, just drop a link to it and that'd be fine. [edited by - Origin on July 18, 2002 8:36:35 AM]
Advertisement
Rather than parsing this file yourself, I think you should have a look at the APIs for automating visual studio. I haven''t used these myself in VS.Net so I can''t tell for sure they have everyting you need, but I''d be surprised if you couldn''t use anything from them. See http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vsintro7/html/vxoriExtensibilityReference.asp and also http://msdn.microsoft.com/msdnmag/issues/02/01/Bugslayer/Bugslayer0201.asp

I don''t know the answer to your questions, but I guess the file format is unsupported (guess you already figured that out, huh?). The first GUID seem to be the version of Visual Studio used when creating the solution. The second GUID seem to be exactly what you say.

OT: Don''t you find it a little bit odd that they don''t use an XML-based format?
developer,

thanks a lot for your hints. Yeah, the file format seems to be
unsupported, that''s not surprising though. That they don''t use
XML for their new workspace file format is really odd because
they use XML for everything else now. The new project files are
also based on XML.

I browsed through the links you posted and will have a detailed
look at them later. I guess that they might help me with my
task but I''m wondering if it wouldn''t actually be easier to
parse the files on my own...

As for the GUIDs, is the first one always the same for VC++ 7.0,
i.e. does the same GUID occur in your solution files, too?
All of my solution files share the same ''first'' GUID, but it''s different from yours. I''m guessing it''s specific to each installation of VS.NET.
Thanks.

I already expected that. It''s probably part of Micro$oft''s
new "transparent user" policy... Maybe the GUID is the encoded
serial number or something like that. I''ll try and see if a
random GUID works as well. If it does, I don''t see a problem
there.

This topic is closed to new replies.

Advertisement