powershell5e452b8e
| 1 | # Publish Release (win-x64, self-contained) and mirror to a fixed path for Cursor MCP. |
| 2 | # Run from repo: cd ...\dotnet-debug-mcp ; .\publish-and-deploy.ps1 |
| 3 | # Optional: -Target "D:\dotnet-debug-mcp" |
| 4 | [CmdletBinding()] |
| 5 | param( |
| 6 | [string] $Target = "D:\dotnet-debug-mcp" |
| 7 | ) |
| 8 | |
| 9 | $ErrorActionPreference = "Stop" |
| 10 | $here = $PSScriptRoot |
| 11 | $csproj = Join-Path $here "DotnetDebugMcp.csproj" |
| 12 | if (-not (Test-Path -LiteralPath $csproj)) { |
| 13 | Write-Error "DotnetDebugMcp.csproj not found. Run this script from the dotnet-debug-mcp directory (PSScriptRoot=$here)." |
| 14 | exit 1 |
| 15 | } |
| 16 | |
| 17 | Push-Location $here |
| 18 | try { |
| 19 | # Prefer local tool (repo-pinned), but global install works too. |
| 20 | if (Test-Path -LiteralPath (Join-Path $here ".config\\dotnet-tools.json")) { |
| 21 | & dotnet aid-publish -Project $csproj -Target $Target -Runtime "win-x64" -Configuration "Release" -SelfContained -KillRunning |
| 22 | } else { |
| 23 | & aid-publish -Project $csproj -Target $Target -Runtime "win-x64" -Configuration "Release" -SelfContained -KillRunning |
| 24 | } |
| 25 | if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } |
| 26 | |
| 27 | $exe = Join-Path $Target "DotnetDebugMcp.exe" |
| 28 | $exeJson = $exe.Replace('\', '\\') |
| 29 | Write-Host "" |
| 30 | Write-Host "Cursor MCP: paste into mcp.json ->" |
| 31 | Write-Host @" |
| 32 | "dotnet-debug": { |
| 33 | "command": "$exeJson", |
| 34 | "args": [] |
| 35 | } |
| 36 | "@ |
| 37 | Write-Host "" |
| 38 | } finally { |
| 39 | Pop-Location |
| 40 | } |
| 41 | |