visual-studiomsbuildcsprojvisual-studio-project

Custom property on projectfile preset by solution


I'm having a custom property on my project to build the same app with different ressources (images).

project.jsproj

<ItemGroup>
    <Content Condition="$(Customization) == ''" Include="images\uwp\*.png" />
    <Content Condition="$(Customization) != ''" Include="images\$(Customization)\uwp\*.png" />
</ItemGroup>

this works fine via msbuild:

msbuild project.jsproj /property:Configuration=Release;Platform=x64;Customization=theme_xy

My question is if there is a possibility to preset this custom property on a solution on VisualStudio that will be applied on a build there as well.

For example:

a) Solution1.sln embedds project.jsproj with Customization property empty

b) Solution2.sln embedds project.jsproj with Customization property = "theme_xy"

Any help is appreciated - thanks


Solution

  • Solved this problem by differentiation of Solution name:

    <PropertyGroup>
        <Customization></Customization>
    </PropertyGroup>
    
    <PropertyGroup Condition="'$(SolutionName)' == 'Solution1'">
        <Customization>theme_xy</Customization>
    </PropertyGroup>