<?xml version="1.0" encoding="utf-8" ?>
<!-- Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information. -->


<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">

  <PropertyGroup>
    <WixRoot>$([System.IO.Path]::GetFullPath($(MSBuildThisFileDirectory)..\))</WixRoot>
    <WIX_ROOT>$(WixRoot)</WIX_ROOT>
  </PropertyGroup>

  <PropertyGroup>
    <WixSrcFolder>$(WixRoot)src\</WixSrcFolder>
    <WixToolsSrcFolder>$(WixRoot)tools\src\</WixToolsSrcFolder>
  </PropertyGroup>

  <!--
    WiX properties that can be overriden by environment variables.
  -->
  <PropertyGroup>
    <WIX_BUILDROOT Condition=" '$(WIX_BUILDROOT)' == '' ">$(WIX_ROOT)build\</WIX_BUILDROOT>
    <WIX_BUILDROOT Condition="!HasTrailingSlash('$(WIX_BUILDROOT)')">$(WIX_BUILDROOT)\</WIX_BUILDROOT>

    <WIX_OBJROOT Condition=" '$(WIX_OBJROOT)' == '' ">$(WIX_BUILDROOT)obj\</WIX_OBJROOT>
    <WIX_OBJROOT Condition="!HasTrailingSlash('$(WIX_OBJROOT)')">$(WIX_OBJROOT)\</WIX_OBJROOT>
    <WixObjRoot>$(WIX_OBJROOT)</WixObjRoot>

    <WIX_EXTERNALROOT Condition=" '$(WIX_EXTERNALROOT)' == '' ">$(WIX_ROOT)tools\external\</WIX_EXTERNALROOT>
    <WIX_EXTERNALROOT Condition="!HasTrailingSlash('$(WIX_EXTERNALROOT)')">$(WIX_EXTERNALROOT)\</WIX_EXTERNALROOT>
  </PropertyGroup>

  <Import Project="Nuget.targets" />

  <!-- Converts the VS-standard Debug and Release to the wix-standard debug and ship -->
  <PropertyGroup Condition=" '$(Configuration)' == 'Debug' or '$(Configuration)' == '' or '$(WixFlavor)' == 'debug' ">
    <WixFlavor>debug</WixFlavor>
    <Configuration>Debug</Configuration>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)' == 'Release' or '$(WixFlavor)' == 'ship' ">
    <WixFlavor>ship</WixFlavor>
    <Configuration>Release</Configuration>
  </PropertyGroup>

  <!-- Directories derived from the current platform and flavor -->
  <PropertyGroup>
    <Platform Condition=" '$(Platform)' == '' ">x86</Platform>
    <Platform Condition=" '$(Platform)' == 'x86' and '$(MSBuildProjectExtension)'=='.vcxproj' ">Win32</Platform>
    <BaseOutputPath>$(WIX_BUILDROOT)$(WixFlavor)\</BaseOutputPath>
    <OutputPath_x86>$(BaseOutputPath)x86\</OutputPath_x86>
    <OutputPath_x64>$(BaseOutputPath)x64\</OutputPath_x64>
    <OutputPath_arm>$(BaseOutputPath)arm\</OutputPath_arm>
    <BuiltIncludePath>$(WIX_BUILDROOT)$(WixFlavor)\inc\</BuiltIncludePath>
    <WixToolPath>$(OutputPath_x86)</WixToolPath>
    <WixTargetsPath>$(OutputPath_x86)wix.targets</WixTargetsPath>
    <WixTargets200xPath>$(OutputPath_x86)wix200x.targets</WixTargets200xPath>
    <WixTargets2010Path>$(OutputPath_x86)wix2010.targets</WixTargets2010Path>
    <WixTasksPath>$(OutputPath_x86)WixTasks.dll</WixTasksPath>
    <WixSdkPath>$(OutputPath_x86)</WixSdkPath>
    <WixSdkX86Path>$(OutputPath_x86)</WixSdkX86Path>
    <WixSdkX64Path>$(OutputPath_x64)</WixSdkX64Path>
    <WixCATargetsPath>$(OutputPath_x86)wix.ca.targets</WixCATargetsPath>
  </PropertyGroup>

  <!-- Directories from installed software. -->
  <PropertyGroup>
    <HelpCompilerPath>$(ProgramFiles)\HTML Help Workshop</HelpCompilerPath>
    <HelpCompiler>$(HelpCompilerPath)\hhc.exe</HelpCompiler>

    <BuildSandcastleDocumentation Condition=" '$(BuildSandcastleDocumentation)'=='' and '$(Configuration)'=='Release' ">true</BuildSandcastleDocumentation>
    <BuildSandcastleDocumentation Condition=" '$(BuildSandcastleDocumentation)'=='' ">false</BuildSandcastleDocumentation>
  </PropertyGroup>

  <PropertyGroup>
    <PotentialPlatformSdkInstallPath>$([MSBuild]::GetRegistryValueFromView('HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows Kits\Installed Roots', 'KitsRoot10', null, RegistryView.Registry64, RegistryView.Registry32))</PotentialPlatformSdkInstallPath>
    <PlatformSdkInstallPath Condition=" '$(PotentialPlatformSdkInstallPath)'!='' and Exists('$(PotentialPlatformSdkInstallPath)\include\10.0.14393.0\um') ">$(PotentialPlatformSdkInstallPath)</PlatformSdkInstallPath>
    <PlatformSdkRegistryVersion Condition=" '$(PlatformSdkInstallPath)'!='' ">v10</PlatformSdkRegistryVersion>
    <PlatformSdkIncludeRoot Condition=" '$(PlatformSdkIncludeRoot)'=='' and '$(PlatformSdkInstallPath)'!='' ">$(PlatformSdkInstallPath)\include\10.0.14393.0</PlatformSdkIncludeRoot>
    <PlatformSdkArmLibraryRoot Condition=" '$(PlatformSdkArmLibraryRoot)'=='' and '$(PlatformSdkInstallPath)'!='' ">$(PlatformSdkInstallPath)lib\10.0.14393.0\um\arm</PlatformSdkArmLibraryRoot>
  </PropertyGroup>

  <PropertyGroup Condition=" '$(PlatformSdkInstallPath)'=='' ">
    <PlatformSdkInstallPath>$([MSBuild]::GetRegistryValueFromView('HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows Kits\Installed Roots', 'KitsRoot81', null, RegistryView.Registry64, RegistryView.Registry32))</PlatformSdkInstallPath>
    <PlatformSdkRegistryVersion Condition=" '$(PlatformSdkInstallPath)'!='' ">v8.1</PlatformSdkRegistryVersion>
  </PropertyGroup>

  <PropertyGroup Condition=" '$(PlatformSdkInstallPath)'=='' ">
    <PlatformSdkInstallPath>$([MSBuild]::GetRegistryValueFromView('HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SDKs\Windows\v8.0', 'InstallationFolder', null, RegistryView.Registry64, RegistryView.Registry32))</PlatformSdkInstallPath>
    <PlatformSdkRegistryVersion Condition=" '$(PlatformSdkInstallPath)'!='' ">v8.0</PlatformSdkRegistryVersion>
  </PropertyGroup>

  <PropertyGroup Condition=" '$(PlatformSdkInstallPath)'=='' ">
    <PlatformSdkInstallPath>$([MSBuild]::GetRegistryValueFromView('HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SDKs\Windows\v7.1A', 'InstallationFolder', null, RegistryView.Registry64, RegistryView.Registry32))</PlatformSdkInstallPath>
    <PlatformSdkRegistryVersion Condition=" '$(PlatformSdkInstallPath)'!='' ">v7.1A</PlatformSdkRegistryVersion>
  </PropertyGroup>

  <PropertyGroup Condition=" '$(PlatformSdkInstallPath)'=='' ">
    <PlatformSdkInstallPath>$([MSBuild]::GetRegistryValueFromView('HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SDKs\Windows\v7.0A', 'InstallationFolder', null, RegistryView.Registry64, RegistryView.Registry32))</PlatformSdkInstallPath>
    <PlatformSdkRegistryVersion Condition=" '$(PlatformSdkInstallPath)'!='' ">v7.0A</PlatformSdkRegistryVersion>
  </PropertyGroup>

  <PropertyGroup>
    <PlatformSdkInstallPath Condition="!HasTrailingSlash('$(PlatformSdkInstallPath)')">$(PlatformSdkInstallPath)\</PlatformSdkInstallPath>

    <PlatformSdkIncludeRoot Condition=" '$(PlatformSdkIncludeRoot)'=='' ">$(PlatformSdkInstallPath)include</PlatformSdkIncludeRoot>
    <PlatformSdkIncludePath Condition=" '$(PlatformSdkIncludePath)'=='' ">$(PlatformSdkIncludeRoot)</PlatformSdkIncludePath>
    <PlatformSdkIncludePath Condition=" Exists('$(PlatformSdkIncludeRoot)\shared') ">$(PlatformSdkIncludePath);$(PlatformSdkIncludeRoot)\shared</PlatformSdkIncludePath>
    <PlatformSdkIncludePath Condition=" Exists('$(PlatformSdkIncludeRoot)\um') ">$(PlatformSdkIncludePath);$(PlatformSdkIncludeRoot)\um</PlatformSdkIncludePath>
    <PlatformSdkBinPath>$(PlatformSdkInstallPath)bin\</PlatformSdkBinPath>
    <PlatformSdkBinPath Condition=" Exists('$(PlatformSdkBinPath)x86') ">$(PlatformSdkBinPath)x86\</PlatformSdkBinPath>
  </PropertyGroup>

  <PropertyGroup>
    <SqlCESdkInstallPath>$([MSBuild]::GetRegistryValueFromView('HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server Compact Edition\v4.0', 'InstallDir', null, RegistryView.Registry32))</SqlCESdkInstallPath>
    <SqlCESdkInstallPath Condition=" '$(SqlCESdkInstallPath)'=='' or !Exists('$(SqlCESdkInstallPath)include') ">$([MSBuild]::GetRegistryValueFromView('HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server Compact Edition\v3.5', 'InstallDir', null, RegistryView.Registry32))</SqlCESdkInstallPath>
    <SqlCESdkInstallPath Condition="!HasTrailingSlash('$(SqlCESdkInstallPath)')">$(SqlCESdkInstallPath)\</SqlCESdkInstallPath>

    <SqlCESdkIncludePath>$(SqlCESdkInstallPath)include\</SqlCESdkIncludePath>
  </PropertyGroup>

  <PropertyGroup>
    <VS2010Path Condition=" '$(VS2010Path)'=='' ">$([MSBuild]::GetRegistryValueFromView('HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\10.0', 'InstallDir', null, RegistryView.Registry64, RegistryView.Registry32))</VS2010Path>
    <VS2010Available Condition=" '$(DisableVS2010)'!='true' and '$(VS2010Path)'!='' and Exists('$(VS2010Path)')">true</VS2010Available>
    <VS2010Available Condition=" '$(VS2010Available)'=='' ">false</VS2010Available>
    <VS2010Path Condition=" $(VS2010Available) and !HasTrailingSlash('$(VS2010Path)')">$(VS2010Path)\</VS2010Path>
  </PropertyGroup>

  <PropertyGroup>
    <VS2012Path Condition=" '$(VS2012Path)'=='' ">$([MSBuild]::GetRegistryValueFromView('HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\11.0', 'InstallDir', null, RegistryView.Registry64, RegistryView.Registry32))</VS2012Path>
    <VS2012Available Condition=" '$(DisableVS2012)'!='true' and '$(VS2012Path)'!='' and Exists('$(VS2012Path)')">true</VS2012Available>
    <VS2012Available Condition=" '$(VS2012Available)'=='' ">false</VS2012Available>
    <VS2012Path Condition=" $(VS2012Available) and !HasTrailingSlash('$(VS2012Path)')">$(VS2012Path)\</VS2012Path>
  </PropertyGroup>

  <PropertyGroup>
    <VS2013Path Condition=" '$(VS2013Path)'=='' ">$([MSBuild]::GetRegistryValueFromView('HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\12.0', 'InstallDir', null, RegistryView.Registry64, RegistryView.Registry32))</VS2013Path>
    <VS2013Available Condition=" '$(DisableVS2013)'!='true' and '$(VS2013Path)'!='' and Exists('$(VS2013Path)')">true</VS2013Available>
    <VS2013Available Condition=" '$(VS2013Available)'=='' ">false</VS2013Available>
    <VS2013Path Condition=" $(VS2013Available) and !HasTrailingSlash('$(VS2013Path)')">$(VS2013Path)\</VS2013Path>
  </PropertyGroup>

  <PropertyGroup>
    <VS2015Path Condition=" '$(VS2015Path)'=='' ">$([MSBuild]::GetRegistryValueFromView('HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\14.0', 'InstallDir', null, RegistryView.Registry64, RegistryView.Registry32))</VS2015Path>
    <VS2015Path Condition=" '$(VS2015Path)'=='' ">$([MSBuild]::GetRegistryValueFromView('HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\WDExpress\14.0', 'InstallDir', null, RegistryView.Registry64, RegistryView.Registry32))</VS2015Path>
    <VS2015Available Condition=" '$(DisableVS2015)'!='true' and '$(VS2015Path)'!='' and Exists('$(VS2015Path)')">true</VS2015Available>
    <VS2015Available Condition=" '$(VS2015Available)'=='' ">false</VS2015Available>
    <VS2015Path Condition=" $(VS2015Available) and !HasTrailingSlash('$(VS2015Path)')">$(VS2015Path)\</VS2015Path>
  </PropertyGroup>

  <PropertyGroup>
    <VS2017Path Condition=" '$(VS2017Path)'=='' and '$(VsInstallRoot)'!=''">$(VsInstallRoot)\</VS2017Path>
    <VS2017Available Condition=" '$(DisableVS2017)'!='true' and '$(VS2017Path)'!='' and Exists('$(VS2017Path)')">true</VS2017Available>
    <VS2017Available Condition=" '$(VS2017Available)'=='' ">false</VS2017Available>
  </PropertyGroup>

  <PropertyGroup>
    <VCPath Condition=" '$(VsInstallRoot)' != ''">$(VsInstallRoot)\VC\</VCPath>
    <VCPath Condition=" '$(VCPath)'=='' ">$([MSBuild]::GetRegistryValueFromView('HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\14.0\Setup\VC', 'ProductDir', null, RegistryView.Registry64, RegistryView.Registry32))</VCPath>
    <VCPath Condition=" '$(VCPath)'=='' ">$([MSBuild]::GetRegistryValueFromView('HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\12.0\Setup\VC', 'ProductDir', null, RegistryView.Registry64, RegistryView.Registry32))</VCPath>
    <VCPath Condition=" '$(VCPath)'=='' ">$([MSBuild]::GetRegistryValueFromView('HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\11.0\Setup\VC', 'ProductDir', null, RegistryView.Registry64, RegistryView.Registry32))</VCPath>
    <VCPath Condition=" '$(VCPath)'=='' ">$([MSBuild]::GetRegistryValueFromView('HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\10.0\Setup\VC', 'ProductDir', null, RegistryView.Registry64, RegistryView.Registry32))</VCPath>
    <VCPath Condition="!HasTrailingSlash('$(VCPath)')">$(VCPath)\</VCPath>

    <VCIncludePath>$(VCPath)include</VCIncludePath>
    <VCBinPath>$(VCPath)bin\</VCBinPath>
  </PropertyGroup>

  <PropertyGroup>
    <BuildARM>$(WindowsSDKDesktopARMSupport)</BuildARM>
    <BuildARM Condition=" '$(BuildARM)'!='true' ">false</BuildARM>
  </PropertyGroup>

  <!-- Properties based on platform and configuration. -->
  <PropertyGroup Condition=" '$(Platform)' == 'x86' or '$(Platform)' == 'Win32' or '$(Platform)' == 'AnyCPU' ">
    <OutputPath>$(OutputPath_x86)</OutputPath>
    <NormalizedPlatform>x86</NormalizedPlatform>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Platform)' == 'x64' ">
    <OutputPath>$(OutputPath_x64)</OutputPath>
    <NormalizedPlatform>$(Platform)</NormalizedPlatform>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Platform)' == 'arm' ">
    <OutputPath>$(OutputPath_arm)</OutputPath>
    <NormalizedPlatform>$(Platform)</NormalizedPlatform>
  </PropertyGroup>

  <PropertyGroup>
    <BaseIntermediateOutputPath>$(WIX_OBJROOT)$(WixFlavor)\$(NormalizedPlatform)\</BaseIntermediateOutputPath>
    <IntermediateOutputPath>$(BaseIntermediateOutputPath)$(MSBuildProjectName)\</IntermediateOutputPath>
  </PropertyGroup>

  <PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
    <DebugType>full</DebugType>
    <DebugSymbols>true</DebugSymbols>
    <Optimize>false</Optimize>
    <DefineConstants>$(DefineConstants);DEBUG</DefineConstants>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
    <DefineConstants>$(DefineConstants)</DefineConstants>
    <DebugType>pdbonly</DebugType>
    <Optimize>true</Optimize>
  </PropertyGroup>


  <!-- This makes the project files a dependency of all targets so that things rebuild if they change -->
  <PropertyGroup>
    <MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildThisFileDirectory)WixBuild.props;$(MSBuildThisFileDirectory)WixBuild.Tools.targets;</MSBuildAllProjects>
  </PropertyGroup>

  <!-- Global setting to control when the bundle is compressed. -->
  <PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
    <WixBundleCompressed>no</WixBundleCompressed>
  </PropertyGroup>
  <PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
    <WixBundleCompressed>yes</WixBundleCompressed>
  </PropertyGroup>

  <!--
    On the build machine the OFFICIAL_WIX_BUILD env var will point to the private key, otherwise
    use the public key in the enlistment.  We must find a key file.
  -->
  <PropertyGroup Condition=" '$(OFFICIAL_WIX_BUILD)'=='' ">
    <AssemblyOriginatorKeyFile>$(MSBuildThisFileDirectory)publickey_wix.snk</AssemblyOriginatorKeyFile>
    <DelaySign>true</DelaySign>
    <SignAssembly>true</SignAssembly>
  </PropertyGroup>

  <PropertyGroup Condition=" '$(OFFICIAL_WIX_BUILD)'!='' ">
    <AssemblyOriginatorKeyFile>$(OFFICIAL_WIX_BUILD)</AssemblyOriginatorKeyFile>
    <DelaySign>false</DelaySign>
    <SignAssembly>true</SignAssembly>
    <BuildSandcastleDocumentation>true</BuildSandcastleDocumentation>
  </PropertyGroup>

  <!-- StyleCop settings -->
  <PropertyGroup>
    <StyleCopTargetsPath>$(EXTERNALROOT)StyleCop\4.0.20.4\MSBuild\Microsoft.StyleCop.targets</StyleCopTargetsPath>
    <StyleCopEnabled Condition=" '$(StyleCopEnabled)' == '' or !Exists('$(StyleCopTargetsPath)')">false</StyleCopEnabled>
    <StyleCopTreatErrorsAsWarnings>false</StyleCopTreatErrorsAsWarnings>
  </PropertyGroup>

  <!-- FxCop settings -->
  <PropertyGroup>
    <FXCOPDIR Condition=" '$(FXCOPDIR)' == '' and Exists('$(EXTERNALROOT)FxCop\')">$(EXTERNALROOT)FxCop\</FXCOPDIR>
    <FxCopEnabled Condition=" '$(FxCopEnabled)' == '' and '$(Configuration)' == 'Release' ">true</FxCopEnabled>
    <FxCopEnabled Condition=" '$(FxCopEnabled)' == '' ">false</FxCopEnabled>
    <CodeAnalysisRuleSet Condition=" '$(CodeAnalysisRuleSet)' == '' ">$(WixRoot)tools\Wix.ruleset</CodeAnalysisRuleSet>
    <RunCodeAnalysis Condition=" '$(FxCopEnabled)' == 'true' and ( '$(BuildingInsideVisualStudio)' == 'true' or '$(FXCOPDIR)' != '' )">true</RunCodeAnalysis>
  </PropertyGroup>

  <!-- Default StaticAnalysis to off. -->
  <PropertyGroup>
    <StaticAnalysisEnabled Condition=" '$(StaticAnalysisEnabled)'=='' ">false</StaticAnalysisEnabled>
  </PropertyGroup>

  <!-- Include the version handling. -->
  <Import Project="WixBuild.Version.targets" />

  <!-- Import project type specific properties. -->
  <Import Project="WixBuild$(MSBuildProjectExtension).props" Condition=" Exists('WixBuild$(MSBuildProjectExtension).props') " />

  <!-- Sentinel value that indicates WixBuid.props has been initialized. -->
  <PropertyGroup>
    <WixBuildPropertiesDefined>true</WixBuildPropertiesDefined>
  </PropertyGroup>

</Project>
