<Project Sdk="WixToolset.Sdk/4.0.1">
  <PropertyGroup>
    <HarvestFileSuppressUniqueIds>false</HarvestFileSuppressUniqueIds>
    <HarvestFileGenerateGuidsNow>true</HarvestFileGenerateGuidsNow>
    <HarvestDirectorySuppressRegistry>false</HarvestDirectorySuppressRegistry>
    <HarvestDirectoryVerboseOutput>true</HarvestDirectoryVerboseOutput>
    <HarvestProjectsDirectoryIds>InstallFolder</HarvestProjectsDirectoryIds>
    <CabinetCachePath>$(OutputPath)bin\cabcache\</CabinetCachePath>
    <ReuseCabinetCache>True</ReuseCabinetCache>
    <SuppressValidation>True</SuppressValidation>
    <BuildProjectReferences>False</BuildProjectReferences>
    <OutputName>Elwig</OutputName>
    <Cultures>de-AT</Cultures>
  </PropertyGroup>
  <UsingTask TaskName="GetFileVersion" TaskFactory="RoslynCodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.Core.dll">
    <ParameterGroup>
      <AssemblyPath ParameterType="System.String" Required="true" />
      <Version ParameterType="System.String" Output="true" />
    </ParameterGroup>
    <Task>
      <Using Namespace="System.Diagnostics" />
      <Code Type="Fragment" Language="cs"><![CDATA[
          this.Version = FileVersionInfo.GetVersionInfo(this.AssemblyPath).ProductVersion;  
        ]]></Code>
    </Task>
  </UsingTask>
  <Target Name="CustomBeforeBuild" BeforeTargets="BeforeBuild">
    <Exec Command="curl -s &quot;http://www.columbia.edu/~em36/PDFtoPrinter.exe&quot; -z &quot;$(TargetDir)PDFtoPrinter.exe&quot; -o &quot;$(TargetDir)PDFtoPrinter.exe&quot;" />
    <Exec Command="dotnet publish &quot;$(SolutionDir)Elwig\Elwig.csproj&quot; &quot;/p:PublishProfile=$(SolutionDir)\Elwig\Properties\PublishProfiles\FolderProfile.pubxml&quot;" />
    <GetFileVersion AssemblyPath="..\Elwig\bin\Publish\Elwig.exe">
      <Output TaskParameter="Version" PropertyName="ElwigFileVersion" />
    </GetFileVersion>
    <PropertyGroup>
      <DefineConstants>ProductVersion=$(ElwigFileVersion);BuildPath=..\Elwig\bin\Publish;DocumentPath=..\Elwig\Documents;ElwigProjectDir=..\Elwig</DefineConstants>
    </PropertyGroup>
  </Target>
  <ItemGroup>
    <HarvestDirectory Include="../Elwig/bin/Publish">
      <ComponentGroupName>BuildFiles</ComponentGroupName>
      <DirectoryRefId>InstallFolder</DirectoryRefId>
      <SuppressRootDirectory>true</SuppressRootDirectory>
      <PreprocessorVariable>BuildPath</PreprocessorVariable>
      <Transforms>BuildFilesTransform.xslt</Transforms>
    </HarvestDirectory>
    <BindPath BindName="BuildBindPath" Include="../Elwig/bin/Publish" />
  </ItemGroup>
  <ItemGroup>
    <HarvestDirectory Include="../Elwig/Documents">
      <ComponentGroupName>DocumentTemplates</ComponentGroupName>
      <DirectoryRefId>ConfigFolderResources</DirectoryRefId>
      <SuppressRootDirectory>true</SuppressRootDirectory>
      <PreprocessorVariable>DocumentPath</PreprocessorVariable>
      <Transforms>DocumentTransform.xslt</Transforms>
    </HarvestDirectory>
    <BindPath BindName="DocumentTemplateBindPath" Include="../Elwig/Documents" />
  </ItemGroup>
  <ItemGroup>
    <None Include="DocumentTransform.xslt" />
    <None Include="BuildFilesTransform.xslt" />
    <None Include="Files\config.ini" />
  </ItemGroup>
  <ItemGroup>
    <PackageReference Include="WixToolset.Heat" Version="4.0.1" />
  </ItemGroup>
</Project>