views:

245

answers:

2

Visual Studio 2010 ("Project Properties" dialog)

I've installed Visual Studio 2010 Ultimate and it has apparently imported the default directories for my Win32 C++ includes and libraries. Every new Win32 C++ project I create automatically adds my old include/library directories which screws up my build.

Here is the "Project Properties" dialog of a new Win32 C++ project:

Project Properties

Clicking <Edit...> takes us to this:

Edit...

It appears the "Inherited values" are coming from $(IncludePath)

So my question is this: How can I edit $(IncludePath) in Visual Studio 2010?

or is $(IncludePath) specific to this project and only the result of the "Inherit from parent or project defaults" checkbox? (in which case the question turns into: How do I edit project defaults for that since it appears to be depreciated in Visual Studio options)

Thanks!

NOTE: The %include% environment variable is not defined in Windows. It does show up if you enter "echo %include%" in the VS2010 command prompt (not the Windows command prompt), but it's not the same values as what I'm trying to get rid of in the screenshots)

+1  A: 
  1. VC++ Directories in VS2010 are project-specific. There are no global settings like in VS2008.
  2. There is INCLUDE environment variable which corresponds to $(IncludePath), so check it first.
  3. Formerly VS saved all global settings in Documents and Settings\\Local Settings\Application Data\Microsoft\VisualStudio\\VCComponents.dat so try to delete such file if it is present for all VS versions. I don't have such file for VS2010, but it's worth checking in your case.

Hope this helps.

fuwaneko
someone else already suggested that it could be the %include% environment variable and then deleted his answer after I told him that %include% is not defined (I should probably add this to the actual question itself)
advs89
As for the "VCComponents.dat," it exists in the \VisualStudio\9.0\ directory (the VS2008 one) but not the \VisualStudio\10.0\ directory (the VS2010 one). I checked the contents of the VS2008 one and it didn't have the same values as above.
advs89
+4  A: 

In VS2010, these paths are specified in one or more property sheets (the respective changes are discussed in an instructive article on the VS Project Team Blog). You can add those yourself per-project, but the project also includes one specifying all the default values.

On my system it is located in C:\Users\<user>\AppData\Local\Microsoft\MSBuild\v4.0\Microsoft.Cpp.Win32.user.props.

You can access it from Visual Studio by opening the Property Manager window (View->Other Windows->Property Manager), and then doubleclick the property sheet. You can also add property sheets yourself from this window (which will take precedence over the default one).

It is also perfectly legal to remove the reference to Microsoft.Cpp.Win32.user.props. That is useful if you need to ensure the project is entirely self-contained: that it doesn't get include paths from the environment, for example. Then you just have to specify the paths in the project itself, or in a custom property sheet that is part of the project (recommended for ease of reuse)

jalf
+1 - this is indeed the important information/change easily overlooked during an upgrade to VS2010; I've added a link to an article explaining these changes, specifically why this has been an important and long overdue move to enable a decent self contained build environment for VC++ as well, e.g. for continuous integration and the like. While it may be annoying and time consuming to convert larger projects especially, it's a one time change and well worth the effort to gain more consistent builds across teams and systems.
Steffen Opel
yep, I love that they made the change... Although they could have made it more accessible. It's not something you figure out easily if you don't know the answer in advance.
jalf
I'll check this tonight but it sounds like this is exactly what I'm looking for... I'll mark accepted if it is.
advs89
+50: You are a genius - that was exactly where it was coming from. Thank You!
advs89