<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.NET.Sdk" ToolsVersion="Current">
  <PropertyGroup>
    <TargetFramework>netstandard2.0</TargetFramework>
    <EmitCompilerGeneratedFiles>true</EmitCompilerGeneratedFiles>
    <CompilerGeneratedFilesOutputPath>$(MSBuildProjectDirectory)\Lightup\.generated</CompilerGeneratedFilesOutputPath>
  </PropertyGroup>
  <ItemGroup>
    <PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="1.3.2" />
    <PackageReference Include="Microsoft.Composition" Version="1.0.27">
      <!-- This package is a dependency of Microsoft.CodeAnalysis.CSharp.Workspaces. It is safe to use since it's compatible with .Net Portable runtime -->
      <NoWarn>NU1701</NoWarn>
    </PackageReference>
    <PackageReference Include="System.Collections.Immutable" Version="1.1.37">
      <!-- Downgrade System.Collections.Immutable to support VS2015 Update 3 -->
      <NoWarn>NU1605, NU1701</NoWarn>
    </PackageReference>

    <ProjectReference Include="..\SonarAnalyzer.ShimLayer\SonarAnalyzer.ShimLayer.csproj" />
  </ItemGroup>

  <ItemGroup>
    <Compile Include="..\Signing.cs" Link="Properties\Signing.cs" />
  </ItemGroup>

  <ItemGroup>
    <Using Include="Microsoft.CodeAnalysis" />
    <Using Include="Microsoft.CodeAnalysis.Diagnostics" />
    <Using Include="SonarAnalyzer.CFG.Extensions" />
    <Using Include="StyleCop.Analyzers.Lightup" />
  </ItemGroup>

  <Target Name="SignDlls" Condition="'$(SignAssembly)' == 'true' and $(TargetFramework) != ''" AfterTargets="Build">
    <Message Importance="high" Text="Signing SonarAnalyzer.CFG assemblies from $(OutDir)" />
    <Exec WorkingDirectory="$(OutDir)" Command="signtool sign /tr http://timestamp.digicert.com /td SHA256 /fd SHA256 /csp &quot;DigiCert Signing Manager KSP&quot; /kc &quot;$(SM_KP)&quot; /f &quot;$(SM_CLIENT_CRT_FILE)&quot; SonarAnalyzer.CFG.dll" />
  </Target>

  <Target Name="CopyBinaries" AfterTargets="Build" DependsOnTargets="SignDlls">
    <ItemGroup>
      <BinariesToCopy Include="$(OutputPath)SonarAnalyzer.CFG.dll" />
      <BinariesToCopy Include="$(OutputPath)SonarAnalyzer.ShimLayer.dll" />
    </ItemGroup>
    <Copy SourceFiles="@(BinariesToCopy)" DestinationFolder="$(BinariesFolder)" />
  </Target>

</Project>
