Skip to content

Fix VS extension: add MenuResourceID to pkgdef and wire up OptionsPag… #24

Fix VS extension: add MenuResourceID to pkgdef and wire up OptionsPag…

Fix VS extension: add MenuResourceID to pkgdef and wire up OptionsPag… #24

Workflow file for this run

name: Build VSIX
on:
push:
branches: [ main, master ]
pull_request:
branches: [ main, master ]
workflow_dispatch:
jobs:
build:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- name: Setup MSBuild
uses: microsoft/setup-msbuild@v2
- name: Setup NuGet
uses: NuGet/setup-nuget@v2
- name: Restore NuGet packages
run: nuget restore OffensiveVS360.sln
- name: Build Release DLL
run: |
msbuild OffensiveVS360.sln /p:Configuration=Release /p:Platform="Any CPU" /p:DeployExtension=false /p:CreateVsixContainer=false /verbosity:minimal /m
- name: Package VSIX
shell: pwsh
run: |
Add-Type -Assembly 'System.IO.Compression'
Add-Type -Assembly 'System.IO.Compression.FileSystem'
$dllDir = "OffensiveVS360\bin\Release\net472"
$staging = "vsix_staging"
New-Item -ItemType Directory $staging -Force | Out-Null
New-Item -ItemType Directory "$staging\Resources" -Force | Out-Null
Copy-Item "$dllDir\OffensiveVS360.dll" $staging
if (Test-Path "$dllDir\Newtonsoft.Json.dll") { Copy-Item "$dllDir\Newtonsoft.Json.dll" $staging }
Copy-Item "OffensiveVS360\Resources\logo.png" "$staging\Resources\"
Copy-Item "vsix_template\extension.vsixmanifest" $staging
Copy-Item "vsix_template\OffensiveVS360.pkgdef" $staging
Copy-Item "vsix_template\Content_Types.xml" "$staging\[Content_Types].xml"
Copy-Item "README.md" $staging
# Copy pre-created manifest.json and catalog.json
Copy-Item "vsix_template\manifest.json" $staging
Copy-Item "vsix_template\catalog.json" $staging
Write-Host "=== VSIX staging contents ==="
Get-ChildItem -Recurse $staging | ForEach-Object { Write-Host $_.FullName }
# Create VSIX using ZipFile (proper OPC packaging, no directory entries)
$vsixPath = [System.IO.Path]::GetFullPath("OffensiveVS360.vsix")
$stagingFull = [System.IO.Path]::GetFullPath($staging)
if (Test-Path $vsixPath) { Remove-Item $vsixPath }
$zip = [System.IO.Compression.ZipFile]::Open($vsixPath, [System.IO.Compression.ZipArchiveMode]::Create)
try {
Get-ChildItem -Recurse -File $staging | ForEach-Object {
$entryName = $_.FullName.Substring($stagingFull.Length + 1).Replace('\', '/')
Write-Host "Adding: $entryName"
[System.IO.Compression.ZipFileExtensions]::CreateEntryFromFile(
$zip, $_.FullName, $entryName, [System.IO.Compression.CompressionLevel]::Optimal
) | Out-Null
}
} finally {
$zip.Dispose()
}
Write-Host "VSIX size: $([math]::Round((Get-Item $vsixPath).Length/1KB,1)) KB"
- name: Upload VSIX artifact
uses: actions/upload-artifact@v4
with:
name: OffensiveVS360-vsix
path: OffensiveVS360.vsix
if-no-files-found: error
retention-days: 30
- name: Publish to Visual Studio Marketplace
if: github.event_name == 'push' && (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main')
shell: pwsh
env:
MARKETPLACE_PAT: ${{ secrets.MARKETPLACE_PAT }}
run: |
$vsixPublisher = & "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe" `
-latest -products * -requires Microsoft.VisualStudio.Component.VSSDK `
-find "VSSDK\VisualStudioIntegration\Tools\Bin\VsixPublisher.exe" 2>$null
if (-not $vsixPublisher) {
$candidates = @(
"${env:ProgramFiles}\Microsoft Visual Studio\2022\Enterprise\VSSDK\VisualStudioIntegration\Tools\Bin\VsixPublisher.exe",
"${env:ProgramFiles}\Microsoft Visual Studio\2022\Professional\VSSDK\VisualStudioIntegration\Tools\Bin\VsixPublisher.exe",
"${env:ProgramFiles}\Microsoft Visual Studio\2022\Community\VSSDK\VisualStudioIntegration\Tools\Bin\VsixPublisher.exe",
"${env:ProgramFiles(x86)}\Microsoft Visual Studio\2022\BuildTools\VSSDK\VisualStudioIntegration\Tools\Bin\VsixPublisher.exe"
)
foreach ($c in $candidates) {
if (Test-Path $c) { $vsixPublisher = $c; break }
}
}
if (-not $vsixPublisher) {
Write-Error "VsixPublisher.exe not found."
exit 1
}
Write-Host "Using VsixPublisher: $vsixPublisher"
Write-Host "Publishing OffensiveVS360.vsix..."
& $vsixPublisher publish `
-payload "OffensiveVS360.vsix" `
-publishManifest "vsix_template\publishManifest.json" `
-personalAccessToken "$env:MARKETPLACE_PAT" `
-ignoreWarnings "VSIXValidatorWarning01,VSIXValidatorWarning02,VSIXValidatorWarning03"
if ($LASTEXITCODE -ne 0) {
Write-Error "VsixPublisher failed with exit code $LASTEXITCODE"
exit $LASTEXITCODE
}
Write-Host "Successfully published to Visual Studio Marketplace."