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

  <PropertyGroup>
    <TargetFramework>$(NetCurrent)</TargetFramework>
    <OutputType>Exe</OutputType>
    <RootNamespace>Microsoft.CodeAnalysis.Tools</RootNamespace>
    <ServerGarbageCollection>true</ServerGarbageCollection>
    <Nullable>Enable</Nullable>
    <NoWarn>$(NoWarn);8002</NoWarn>
    <Description>Command line tool for formatting C# and Visual Basic code files based on .editorconfig settings.</Description>
    <RollForward>LatestMajor</RollForward>

    <IsPackable>true</IsPackable>
    <PackAsTool>true</PackAsTool>
    <PackageIcon>Icon.png</PackageIcon>
    <PackageIconFullPath>$(MSBuildThisFileDirectory)Resources\icon.png</PackageIconFullPath>

    <!-- Copy nuget assemblies to build directory. -->
    <CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>

    <SignableShimRuntimeIdentifiers>win-x64;win-x86;osx-x64</SignableShimRuntimeIdentifiers>

    <!--
      These identifiers are for generating the shim'd core executables for signing. Not all options
      from $(RoslynPortableRuntimeIdentifiers) work or make sense in this context.
    -->
    <PackAsToolShimRuntimeIdentifiers Condition="'$(DotNetBuild)' != 'true'">win-x64;win-x86;osx-x64</PackAsToolShimRuntimeIdentifiers>
    <PackAsToolShimRuntimeIdentifiers Condition="'$(DotNetBuild)' == 'true' and $(SignableShimRuntimeIdentifier.Contains('$(TargetRid)'))">$(TargetRid)</PackAsToolShimRuntimeIdentifiers>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="Microsoft.Build" ExcludeAssets="Runtime" PrivateAssets="All" />
    <PackageReference Include="Microsoft.Build.Framework" ExcludeAssets="Runtime" PrivateAssets="All" />
    <PackageReference Include="Microsoft.Build.Locator" />

    <PackageReference Include="Microsoft.CodeAnalysis" />
    <PackageReference Include="Microsoft.CodeAnalysis.CSharp" />
    <PackageReference Include="Microsoft.CodeAnalysis.VisualBasic" />
    <PackageReference Include="Microsoft.CodeAnalysis.Workspaces.MSBuild" />

    <!-- Loaded dynamically -->
    <PackageReference Include="Microsoft.CodeAnalysis.CSharp.Features" />
    <PackageReference Include="Microsoft.CodeAnalysis.Features" />
    <PackageReference Include="Microsoft.CodeAnalysis.VisualBasic.Features" />

    <PackageReference Include="Microsoft.Extensions.FileSystemGlobbing" />
    <PackageReference Include="Microsoft.Extensions.Logging" />

    <PackageReference Include="System.CommandLine" />
    <PackageReference Include="System.CommandLine.Rendering" />
  </ItemGroup>

  <ItemGroup>
    <InternalsVisibleTo Include="dotnet-format.UnitTests" />
    <InternalsVisibleTo Include="dotnet-format.PerformanceTests" />
  </ItemGroup>

  <ItemGroup>
    <None Include="..\README.md" />
  </ItemGroup>

  <ItemGroup>
    <EmbeddedResource Update="Resources.resx" GenerateSource="true" />
  </ItemGroup>

</Project>
