<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net10.0-windows</TargetFramework>
<UseWindowsForms>true</UseWindowsForms>
<PublishAot>false</PublishAot>
<GenerateAssemblyInfo>true</GenerateAssemblyInfo>
<GenerateTargetFrameworkAttribute>false</GenerateTargetFrameworkAttribute>
<!-- Assembly and Namespace Configuration -->
<AssemblyName>excelcli</AssemblyName>
<RootNamespace>Sbroenne.ExcelMcp.CLI</RootNamespace>
<!-- Enable generated CLI Settings and Command classes -->
<DefineConstants>$(DefineConstants);SPECTRE_CONSOLE;EXCELCLI</DefineConstants>
<!-- CLI doesn't need XML documentation warnings - command usage is shown in console output -->
<NoWarn>$(NoWarn);CS1591</NoWarn>
<!-- Version Information -->
<Version>1.0.0</Version>
<AssemblyVersion>1.0.0.0</AssemblyVersion>
<FileVersion>1.0.0.0</FileVersion>
<!-- Package-specific properties -->
<PackageId>Sbroenne.ExcelMcp.CLI</PackageId>
<Title>ExcelMcp CLI</Title>
<Description>Command-line interface tool for automating Microsoft Excel operations using COM interop by Sbroenne. 165 operations across Power Query M code, Power Pivot DAX measures, VBA macros, PivotTables, Excel Tables, ranges, formatting, data validation, and connections. Perfect for RPA, CI/CD pipelines, scripting (PowerShell/Bash), and batch processing. Windows x64 and ARM64 support.</Description>
<PackageTags>excel;cli;powerquery;dax;power-pivot;automation;com;rpa;ci-cd;scripting;github-copilot;mcp;windows;dotnet-tool;sbroenne;excel-automation;vba;pivottables;excel-tables;batch-processing;devops</PackageTags>
<PackageReadmeFile>README.md</PackageReadmeFile>
<PackageReleaseNotes>See https://github.com/sbroenne/mcp-server-excel/releases for release notes</PackageReleaseNotes>
<PackageRequireLicenseAcceptance>false</PackageRequireLicenseAcceptance>
<GeneratePackageOnBuild>false</GeneratePackageOnBuild>
<IsPublishable>true</IsPublishable>
<!-- .NET Tool Configuration -->
<PackAsTool>true</PackAsTool>
<ToolCommandName>excelcli</ToolCommandName>
<!-- Package Validation -->
<EnablePackageValidation>true</EnablePackageValidation>
</PropertyGroup>
<!-- Release Build Optimizations -->
<PropertyGroup Condition="'$(Configuration)' == 'Release'">
<!-- Disable debug symbols in Release builds -->
<DebugType>none</DebugType>
<DebugSymbols>false</DebugSymbols>
<!-- Additional optimization flags -->
<Optimize>true</Optimize>
<TieredCompilation>true</TieredCompilation>
<TieredCompilationQuickJit>true</TieredCompilationQuickJit>
</PropertyGroup>
<!-- Exclude XML and PDB files from publish output -->
<!-- Note: Must run AfterTargets="Publish" (not Build) for PublishSingleFile compatibility.
GenerateBundle needs all files present during bundling, so we clean up after. -->
<Target Name="RemoveXmlAndPdbFromPublish" AfterTargets="Publish" Condition="'$(Configuration)' == 'Release'">
<ItemGroup>
<XmlFilesToDelete Include="$(PublishDir)**\*.xml" />
<PdbFilesToDelete Include="$(PublishDir)**\*.pdb" />
</ItemGroup>
<Delete Files="@(XmlFilesToDelete)" />
<Delete Files="@(PdbFilesToDelete)" />
<Message Text="Removed XML documentation and PDB files from publish output" Importance="high" />
</Target>
<ItemGroup>
<PackageReference Include="Spectre.Console" />
<PackageReference Include="Spectre.Console.Cli" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" />
<PackageReference Include="Microsoft.CodeAnalysis.NetAnalyzers">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
</ItemGroup>
<ItemGroup>
<None Include="..\..\LICENSE" Pack="true" PackagePath="" />
<None Include="README.md" Pack="true" PackagePath="\" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Resources\excelcli.ico" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\ExcelMcp.Core\ExcelMcp.Core.csproj" />
<ProjectReference Include="..\ExcelMcp.ComInterop\ExcelMcp.ComInterop.csproj" />
<ProjectReference Include="..\ExcelMcp.Service\ExcelMcp.Service.csproj" />
<!-- CLI Settings Generator - generates Settings classes with Spectre.Console attributes -->
<ProjectReference Include="..\ExcelMcp.Generators.Cli\ExcelMcp.Generators.Cli.csproj"
OutputItemType="Analyzer"
ReferenceOutputAssembly="false" />
<!-- Build.Tasks - ensures skill generator is built before AfterBuild target runs -->
<ProjectReference Include="..\ExcelMcp.Build.Tasks\ExcelMcp.Build.Tasks.csproj"
ReferenceOutputAssembly="false"
PrivateAssets="all" />
</ItemGroup>
<!-- Allow CLI integration tests to access internal command infrastructure -->
<ItemGroup>
<InternalsVisibleTo Include="Sbroenne.ExcelMcp.CLI.Tests" />
</ItemGroup>
<!-- Workaround for NETSDK1146: PackAsTool doesn't support net10.0-windows -->
<!-- See: https://github.com/dotnet/sdk/issues/12055#issuecomment-2125927648 -->
<Target Name="HackBeforePackToolValidation" BeforeTargets="_PackToolValidation">
<PropertyGroup>
<TargetPlatformIdentifier></TargetPlatformIdentifier>
<TargetPlatformMoniker></TargetPlatformMoniker>
</PropertyGroup>
</Target>
<Target Name="HackAfterPackToolValidation" AfterTargets="_PackToolValidation" BeforeTargets="PackTool">
<PropertyGroup>
<TargetPlatformIdentifier>Windows</TargetPlatformIdentifier>
</PropertyGroup>
</Target>
<!-- Import the Build.Tasks project to use GenerateSkillFile task -->
<UsingTask TaskName="Sbroenne.ExcelMcp.Build.Tasks.GenerateSkillFile"
AssemblyFile="$(MSBuildProjectDirectory)\..\ExcelMcp.Build.Tasks\bin\$(Configuration)\netstandard2.0\Sbroenne.ExcelMcp.Build.Tasks.dll" />
<!-- Generate CLI Skill file from template after build -->
<Target Name="GenerateCliSkill" AfterTargets="Build" Condition="'$(Configuration)' == 'Release'"
Inputs="$(MSBuildProjectDirectory)\..\..\skills\templates\SKILL.cli.sbn;$(MSBuildProjectDirectory)\..\ExcelMcp.Core\obj\GeneratedFiles\ExcelMcp.Generators\Sbroenne.ExcelMcp.Generators.ServiceRegistryGenerator\_SkillManifest.g.cs"
Outputs="$(MSBuildProjectDirectory)\..\..\skills\excel-cli\SKILL.md">
<PropertyGroup>
<SkillTemplatePath>$(MSBuildProjectDirectory)\..\..\skills\templates\SKILL.cli.sbn</SkillTemplatePath>
<SkillOutputPath>$(MSBuildProjectDirectory)\..\..\skills\excel-cli\SKILL.md</SkillOutputPath>
<!-- Manifest is generated by ServiceRegistryGenerator into Core's GeneratedFiles folder -->
<SkillManifestPath>$(MSBuildProjectDirectory)\..\ExcelMcp.Core\obj\GeneratedFiles\ExcelMcp.Generators\Sbroenne.ExcelMcp.Generators.ServiceRegistryGenerator\_SkillManifest.g.cs</SkillManifestPath>
</PropertyGroup>
<Message Text="Generating CLI Skill from template..." Importance="high" />
<GenerateSkillFile
TemplatePath="$(SkillTemplatePath)"
OutputPath="$(SkillOutputPath)"
ManifestPath="$(SkillManifestPath)" />
<Message Text="Generated CLI Skill: $(SkillOutputPath)" Importance="high" />
</Target>
<!-- Copy shared references to CLI skill folder after skill generation -->
<Target Name="CopyCliReferences" AfterTargets="GenerateCliSkill" Condition="'$(Configuration)' == 'Release'">
<PropertyGroup>
<SharedDir>$(MSBuildProjectDirectory)\..\..\skills\shared</SharedDir>
<RefsDir>$(MSBuildProjectDirectory)\..\..\skills\excel-cli\references</RefsDir>
</PropertyGroup>
<ItemGroup>
<!-- Copy ALL skill references from shared directory -->
<CliReferenceFiles Include="$(SharedDir)\*.md" />
</ItemGroup>
<MakeDir Directories="$(RefsDir)" Condition="!Exists('$(RefsDir)')" />
<Copy SourceFiles="@(CliReferenceFiles)" DestinationFolder="$(RefsDir)" SkipUnchangedFiles="true" />
<Message Text="Copied CLI references to $(RefsDir)" Importance="high" />
</Target>
</Project>