<Project Sdk="WixToolset.Sdk/5.0.0">
  <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.Split('+')[0];
        ]]></Code>
    </Task>
  </UsingTask>
  <Target Name="CustomBeforeBuild" BeforeTargets="BeforeBuild">
    <Exec Command="curl --fail -s -L &quot;https://github.com/emendelson/pdftoprinter/raw/main/PDFtoPrinter.exe&quot; -z &quot;$(ProjectDir)\Files\PDFtoPrinter.exe&quot; -o &quot;$(ProjectDir)\Files\PDFtoPrinter.exe&quot;" />
    <Exec Command="dotnet publish &quot;$(ProjectDir)\..\Elwig\Elwig.csproj&quot; &quot;/p:PublishProfile=$(ProjectDir)\..\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>
    <None Include="Files\config.ini" />
    <None Include="Files\PDFtoPrinter.exe" />
    <None Include="Files\WinziPrint.exe" />
  </ItemGroup>
</Project>