/XamlColorSchemeGenerator

Generates color scheme xaml files while replacing certain parts of a template file

Primary LanguageC#MIT LicenseMIT

XamlColorSchemeGenerator

Build status Release Issues Downloads Nuget License

Generates color scheme xaml files while replacing certain parts of a template file.

For an example on how this tool works see the generator input and template files.

Using the tool

Usage with commandline parameters

XamlColorSchemeGenerator accepts the following commandline parameters:

  • -g "Path_To_Your_GeneratorParameters.json"
  • -g "Path_To_Your_Theme.Template.xaml"
  • -o "Path_To_Your_Output_Folder"
  • -v = enables verbose console output

Usage without commandline parameters

Just set the working directory to a directory containing GeneratorParameters.json and Theme.Template.xaml and call XamlColorSchemeGenerator.exe. The tool then also uses the current working dir as the output folder.

Usage during build

    <ItemGroup>
      <PackageReference Include="XamlColorSchemeGenerator" version="3.*" privateAssets="All" />
    </ItemGroup>

    <Target Name="GenerateXamlFilesInner">
      <PropertyGroup>
        <XamlColorSchemeGeneratorVersion Condition="'%(PackageReference.Identity)' == 'XamlColorSchemeGenerator'">%(PackageReference.Version)</XamlColorSchemeGeneratorVersion>
        <XamlColorSchemeGeneratorPath>$(NuGetPackageRoot)/xamlcolorschemegenerator/$(XamlColorSchemeGeneratorVersion)/tools/XamlColorSchemeGenerator.exe</XamlColorSchemeGeneratorPath>
      </PropertyGroup>
      <!-- Generate theme files -->
      <Exec Command="&quot;$(XamlColorSchemeGeneratorPath)&quot;" WorkingDirectory="$(MSBuildProjectDirectory)/Themes/Themes" />
    </Target>

    <!-- Key to generating the xaml files at the right point in time is to do this before DispatchToInnerBuilds -->
    <Target Name="GenerateXamlFiles" BeforeTargets="DispatchToInnerBuilds;BeforeBuild">
      <!--TargetFramework=once is critical here, as it will not execute task from same project with same properties multiple times. 
        We need to unify TargetFramework between empty, net45, netcoreapp3.0 etc.-->
      <MSBuild Projects="$(MSBuildProjectFile)" Targets="GenerateXamlFilesInner" Properties="TargetFramework=once" />
    </Target>