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

  <PropertyGroup>
    <OutputType>WinExe</OutputType>
    <TargetFramework>net48</TargetFramework>
    <Nullable>enable</Nullable>
    <UseWindowsForms>true</UseWindowsForms>
    <ImplicitUsings>enable</ImplicitUsings>
    <LangVersion>latest</LangVersion>
    <ApplicationManifest>app.manifest</ApplicationManifest>
    <ApplicationIcon>vwe.ico</ApplicationIcon>
    <AssemblyTitle>vPLASMA — Virtual plasma display</AssemblyTitle>
    <!-- StampGitVersion already puts the sha in InformationalVersion; stop the
         SDK appending "+fullsha" on top of it. -->
    <IncludeSourceRevisionInInformationalVersion>false</IncludeSourceRevisionInInformationalVersion>
  </PropertyGroup>

  <ItemGroup>
    <ProjectReference Include="..\VPlasma.Core\VPlasma.Core.csproj" />
  </ItemGroup>

  <!-- Stamp commit date + short sha into InformationalVersion; the window
       title shows it (Application.ProductVersion) so a running build can be
       matched to its vYYYY.MM.DD release tag at a glance. Falls back to the
       default 1.0.0 when git isn't available. -->
  <Target Name="StampGitVersion" BeforeTargets="GetAssemblyVersion" Condition="'$(DesignTimeBuild)' != 'true'">
    <!-- %%cs survives cmd's percent expansion as %cs: committer date, YYYY-MM-DD. -->
    <Exec Command="git -C &quot;$(MSBuildProjectDirectory)&quot; log -1 --format=%%cs"
          ConsoleToMSBuild="true" StandardOutputImportance="low" IgnoreExitCode="true" ContinueOnError="true">
      <Output TaskParameter="ConsoleOutput" PropertyName="GitCommitDate" />
      <Output TaskParameter="ExitCode" PropertyName="GitDateExitCode" />
    </Exec>
    <!-- The exclude flag keeps describe off the release tags: always the short
         sha, with a "dirty" suffix when the working tree has local edits. -->
    <Exec Command="git -C &quot;$(MSBuildProjectDirectory)&quot; describe --always --dirty --exclude=*"
          ConsoleToMSBuild="true" StandardOutputImportance="low" IgnoreExitCode="true" ContinueOnError="true">
      <Output TaskParameter="ConsoleOutput" PropertyName="GitShortSha" />
    </Exec>
    <PropertyGroup Condition="'$(GitDateExitCode)' == '0' And '$(GitShortSha)' != ''">
      <InformationalVersion>$(GitCommitDate.Trim().Replace('-', '.')) ($(GitShortSha))</InformationalVersion>
    </PropertyGroup>
  </Target>

  <ItemGroup>
    <PackageReference Include="PolySharp" Version="1.14.1">
      <PrivateAssets>all</PrivateAssets>
      <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
    </PackageReference>
  </ItemGroup>

</Project>
