<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>net6.0</TargetFramework>
    <AutoGenerateBindingRedirects>false</AutoGenerateBindingRedirects>
    <PublishSingleFile>true</PublishSingleFile>
    <SelfContained>true</SelfContained>
    <EnableCompressionInSingleFile>true</EnableCompressionInSingleFile>
    <IncludeNativeLibrariesForSelfExtract>true</IncludeNativeLibrariesForSelfExtract>
    <RuntimeIdentifier>win-x64</RuntimeIdentifier>
    <PlatformTarget>AnyCPU</PlatformTarget>
    <Authors>Nick Babcock</Authors>

    <Description>Extract hardware sensor data and exports it to a given host and port in a graphite compatible format</Description>
    <Copyright>Nick Babcock</Copyright>
    <Major>0</Major>
    <Minor>28</Minor>
    <Revision>0</Revision>
    <AssemblyVersion>$(Major).$(Minor).$(Revision)</AssemblyVersion>
    <AssemblyFileVersion>$(Major).$(Minor).$(Revision)</AssemblyFileVersion>
    <InformationalVersion>$(Major).$(Minor).$(Revision)</InformationalVersion>
    <Version>$(Major).$(Minor).$(Revision)</Version>
    <FileVersion>$(Major).$(Minor).$(Revision)</FileVersion>
    <ApplicationManifest>app.manifest</ApplicationManifest>
  </PropertyGroup>

  <ItemGroup>
    <Content Include="NLog.config">
      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
    </Content>
    <EmbeddedResource Include="..\assets\schema.sql">
      <LogicalName>schema.sql</LogicalName>
    </EmbeddedResource>
  </ItemGroup>

  <ItemGroup>
    <PackageReference Include="LibreHardwareMonitorLib" Version="0.9.2-pre186" />
    <PackageReference Include="InfluxDB.Client" Version="4.9.0" />
    <PackageReference Include="Npgsql" Version="7.0.0" />
    <PackageReference Include="prometheus-net" Version="7.0.0" />
    <PackageReference Include="System.Configuration.ConfigurationManager" Version="7.0.0" />
    <PackageReference Include="TopShelf" Version="4.3.0" />
    <PackageReference Include="Topshelf.NLog" Version="4.3.0" />
    <PackageReference Include="InfluxDB.LineProtocol" Version="1.1.1" />
  </ItemGroup>

  <Target Name="ZipOutputPath" AfterTargets="Publish">
    <RemoveDir Directories="$(BaseOutputPath)tmp\" ContinueOnError="true" />
    <MakeDir Directories="$(BaseOutputPath)tmp\" />
    <Copy SourceFiles="$(OutputPath)\publish\OhmGraphite.exe" DestinationFolder="$(BaseOutputPath)tmp\" />
    <Copy SourceFiles="$(OutputPath)\publish\OhmGraphite.dll.config" DestinationFiles="$(BaseOutputPath)tmp\OhmGraphite.exe.config" />
    <Copy SourceFiles="$(OutputPath)\publish\NLog.config" DestinationFolder="$(BaseOutputPath)tmp\" />

    <ZipDirectory Overwrite="true" SourceDirectory="$(BaseOutputPath)\tmp" DestinationFile="$(BaseOutputPath)OhmGraphite-$(Major).$(Minor).$(Revision).zip" />
  </Target>
</Project>
