I would like to redefine the directories used by Visual Studio (devenv.exe) for the compiler and library paths. I know how to do this interactively using Tools-> Options-> VC ++ Directories, but I would like to automate this.
http://msdn.microsoft.com/en-us/library/t9az1d21(VS.80).aspx has a tempting note: "If you want to configure directory search paths (for your projects) that may be used by other users or which can be used on different computers, Visual C ++ provides an alternative to using this dialog through project property sheets. For more information, see "Property sheets (C ++)".
If you follow the link to the Property Sheets documentation, there is a ton of information about the mechanism, but not one of the actual properties that you need to set.
I found the information populated by the VC ++ Directories dialog box in% LocalAppData% \ Microsoft \ VisualStudio \ 8.0 \ VCComponents.dat (for VS 2005 and 9.0 for VS 2008); it seems to set various properties in the VC \ VC_OBJECTS_PLATFORM_INFO \ win32 \ Directories and ... \ x64 \ Directories folders.
Has anyone done this before and found out what a mapping is from the property names used in VCComponents.dat for the names to be used in the .vsprops file?
I would like this to work in VS2005, VS2008 and VS2010, ideally.
In VS2010, Microsoft has completely done away with the VC ++ Directories dialog box in the "View Settings" section by executing it for each project, and now you get an interactive interface for editing these directories in the "Project Properties" instead of the "View Settings"; it also means that there is a user interface in the property manager; then, if you want to make changes for each machine instead of one project, as it was before, you simply set the property sheet as you want and make all your projects inheritable. This sounds like a big improvement over the old way. And a direct way to do what I want to do. But only in VS2010.
VS2005 and VS2008 do not have a user interface to set these properties in the project file or properties; I am happy to do it manually, but I do not know what it should look like!
Here is the empty VS 2005.vsprops file:
<?xml version="1.0"?> <VisualStudioPropertySheet ProjectType="Visual C++" Version="8.00" Name="pathSettings" > </VisualStudioPropertySheet>
I installed VS 2010 and used my new graphical interface to make changes to the search directories; it looks like this:
<?xml version="1.0" encoding="utf-8"?> <Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <ImportGroup Label="PropertySheets" /> <PropertyGroup> <ExecutablePath>C:\Test;$(PATH)</ExecutablePath> </PropertyGroup> </Project>
However, this does not work verbatim in VS2005 - VS2005 refuses to load it (complaining that a DTD / schema declaration was not found).
I put it in a container, in response to which VS2005 tells me that the “PropertyGroup element” is unexpected according to the content model of the parent element “VisualStudioPropertySheet.” Expectation: tool, UserMacro ". The tool and UserMacro are the only ones shown in the example on the MSDN page [drat - StackOverflow does not allow me because the new user puts a hyperlink here - the first Google search for the "usermacro properties tool"] - maybe those are the only things legit in the properties sheet of VS2005?