Does VC2010 property sheet support different Confiugration and platforms?
-
Tuesday, October 18, 2011 9:53 AM
Hi,
I know that the VC2010 property sheet file(.props) could define some common project settins like user-defined environment variables, then all projects could import this file to share these common settings.
But it seems to me that property sheet file doesn't support different configuration(Debug or Release), or different platforms(Win32 or x64), because the UI controls for setting these are grayed out, see the attached screenshot.
What I want to do is to define different settings for different configuration/platforms in a single file, and let all projects import this file.
Is this possible?
Best regards,
All Replies
-
Wednesday, October 19, 2011 2:36 AMModerator
Hi Qu,
You can organize the property sheet under property manager, View->Property Manager. The Property Manager use the subfolder such as Configuration|Platform to manage the property sheets. You can add a property sheet to the exact property sub folder to take effect on specific configuration and platform.If you want to manager all configuration in one files, you need to modify your property sheet manually. As we know the property sheet is a MSbuild script Based file, you can open the prop file using editor and add the condition for your property group. The following is an example:
<?xml version="1.0" encoding="utf-8"?> <Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <ImportGroup Label="PropertySheets" /> <PropertyGroup Label="UserMacros" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> <aaa>D:\</aaa> </PropertyGroup> <PropertyGroup Label="UserMacros" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> <aaa>C:\</aaa> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> <ExecutablePath>$(ExecutablePath) C:\;</ExecutablePath> </PropertyGroup> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> <ExecutablePath>$(ExecutablePath) D:\;</ExecutablePath> </PropertyGroup> <ItemDefinitionGroup /> <ItemGroup> <BuildMacro Include="aaa"> <Value>$(aaa)</Value> </BuildMacro> </ItemGroup> </Project>Regards,
Yi
Yi Feng Li [MSFT]
MSDN Community Support | Feedback to us
Get or Request Code Sample from Microsoft
Please remember to mark the replies as answers if they help and unmark them if they provide no help.

- Edited by Yi Feng LiModerator Wednesday, October 19, 2011 3:03 AM
- Marked As Answer by Yi Feng LiModerator Friday, October 28, 2011 3:13 AM
-
Wednesday, October 19, 2011 4:07 AM
Thanks. Assume that I manually edited the shared property sheet file by adding these settings below:
<PropertyGroup> <_ProjectFileVersion>10.0.40219.1</_ProjectFileVersion> <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">..\..\build\bind\</OutDir> <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">..\..\build\bindx64\</OutDir> <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">..\..\build\intermed\$(Configuration)\$(TargetName)\</IntDir> <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">..\..\build\intermedx64\$(Configuration)\$(TargetName)\</IntDir> <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental> <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</LinkIncremental> <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">..\..\build\intermed\$(Configuration)\$(TargetName)\</OutDir> <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">..\..\build\intermed\$(Configuration)\$(TargetName)\</OutDir> <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">..\..\build\intermed\$(Configuration)\$(TargetName)\</IntDir> <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">..\..\build\intermed\$(Configuration)\$(TargetName)\</IntDir> <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental> <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</LinkIncremental> </PropertyGroup>
My question is although most the projects in the solution share these settings, but I can still overwrite these on a individual project basis by editing the Property Pages for this specific project, correct?
Best regards,- Edited by Qu En Wednesday, October 19, 2011 4:08 AM
-
Wednesday, October 19, 2011 9:54 AMModerator
Hi
If you modified the property pages via IDE, VS Editor will help write an equivalent MSBuild Script in the property sheet without any condition, therefore, it will apply to all the configuration and the project using this property sheet file.
My suggestion is to apply an individual property sheet for the specific project, if you want to customize a single project.
Regards,
Yi
Yi Feng Li [MSFT]
MSDN Community Support | Feedback to us
Get or Request Code Sample from Microsoft
Please remember to mark the replies as answers if they help and unmark them if they provide no help.

- Marked As Answer by Yi Feng LiModerator Friday, October 28, 2011 3:13 AM
-
Friday, October 21, 2011 9:59 AMModerator
Hello,
I am writing to check the status of the issue on your side. Would you mind letting us know the result of the suggestions?
Yi
Yi Feng Li [MSFT]
MSDN Community Support | Feedback to us
Get or Request Code Sample from Microsoft
Please remember to mark the replies as answers if they help and unmark them if they provide no help.

-
Wednesday, November 02, 2011 8:28 AMYes, please close this thread.
Best regards,

