Determine location of common folders?

Does MSBuild provide any way to discover the location of common folders on the current system

I'm specifically thinking of the "Program Files" directory which has different names in different localized versions of Windows. NAnt has a convenient <sysinfo/> tasks that loads all sorts of local system information into predefined properties, including the name of "Program Files". Anything like that in MSBuild


Answer this question

Determine location of common folders?

  • Roggan

    Chris,

    MSBuild automatically sets up all environment variables in the current environment as properties for use by projects.  For example, the "Program Files" directory can be accessed in an MSBuild project by using the property "$(ProgramFiles)", which is a standard environment variable in command windows.  You could get the value of the current user's "Documents and Settings" folder by using the property "$(HOMEDRIVE)$(HOMEPATH)".  Again, you don't need to do anything special to define these, the MSBuild engine will automatically do it.

    jeff
    tester on msbuild

  • mel001212100121

    Thanks, Jeff!  As a matter of fact I did a 'set | grep "Program Files"' to check whether such an environment variable exists but then simply overlooked the ProgramFiles variable in the output. Must be getting senile...

    Would you happen to know on which systems ProgramFiles is defined   Is this universal for all .NET-capable systems, from  Windows 98 on up   I seem to recall that only NT systems offer the full set of informational environment variables, though I may be wrong there.

  • crillion

    is there a list of all predefined properties by msbuild

    I need a path to COMMON_APPDATA later maybe to other system locations how can access them from msbuild



  • Determine location of common folders?