Skip to content

Commit 9581049

Browse files
committed
Used VSSDK to publish to the marketplace.
1 parent b200985 commit 9581049

File tree

7 files changed

+88
-57
lines changed

7 files changed

+88
-57
lines changed
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: Publish Visual Studio 2022 Extension
2+
3+
on: workflow_dispatch
4+
5+
jobs:
6+
publish-visual-studio:
7+
runs-on: windows-2022
8+
9+
env:
10+
Configuration: Release
11+
DeployExtension: false
12+
13+
steps:
14+
- name: Checkout
15+
uses: actions/checkout@v2
16+
17+
- name: Setup MSBuild
18+
uses: microsoft/setup-msbuild@v1.0.2
19+
20+
- name: Publish
21+
working-directory: ./visual-studio
22+
run: msbuild /t:PublishToMarketplace /Restore /v:Minimal /p:Configuration=Release /p:PersonalAccessToken=${{ secrets.PUBLISHER_TOKEN }}

.github/workflows/publish.yml

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -26,27 +26,27 @@ jobs:
2626
PUBLISHER_TOKEN: ${{ secrets.PUBLISHER_TOKEN }}
2727
run: node_modules/.bin/vsce publish -p $PUBLISHER_TOKEN
2828

29-
publish-visual-studio:
30-
runs-on: windows-2022
31-
32-
env:
33-
Configuration: Release
34-
DeployExtension: false
35-
36-
steps:
37-
- name: Checkout
38-
uses: actions/checkout@v2
39-
40-
- name: Setup MSBuild
41-
uses: microsoft/setup-msbuild@v1.0.2
42-
43-
- name: Build
44-
working-directory: ./visual-studio
45-
run: msbuild /t:Rebuild /Restore /v:Minimal
46-
47-
- name: Publish
48-
uses: cezarypiatek/VsixPublisherAction@0.2
49-
with:
50-
extension-file: visual-studio\source\GitWebLinks\bin\Release\GitWebLinks.vsix
51-
publish-manifest-file: visual-studio\publish.json
52-
personal-access-code: ${{ secrets.PUBLISHER_TOKEN }}
29+
# publish-visual-studio:
30+
# runs-on: windows-2022
31+
32+
# env:
33+
# Configuration: Release
34+
# DeployExtension: false
35+
36+
# steps:
37+
# - name: Checkout
38+
# uses: actions/checkout@v2
39+
40+
# - name: Setup MSBuild
41+
# uses: microsoft/setup-msbuild@v1.0.2
42+
43+
# - name: Build
44+
# working-directory: ./visual-studio
45+
# run: msbuild /t:Rebuild /Restore /v:Minimal
46+
47+
# - name: Publish
48+
# uses: cezarypiatek/VsixPublisherAction@0.2
49+
# with:
50+
# extension-file: visual-studio\source\GitWebLinks\bin\Release\GitWebLinks.vsix
51+
# publish-manifest-file: visual-studio\publish.json
52+
# personal-access-code: ${{ secrets.PUBLISHER_TOKEN }}

build/set-version.ps1

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ try {
4343
}
4444

4545
Write-Host "Updating Visual Studio extension..."
46+
# Set the version in the props file.
4647
$manifestFileName = Join-Path $root -ChildPath "visual-studio/source/GitWebLinks/source.extension.vsixmanifest"
4748
$manifest = New-Object -TypeName System.Xml.XmlDocument
4849
$manifest.PreserveWhitespace = $true
@@ -52,9 +53,16 @@ $identity = Select-Xml -Xml $manifest -XPath "/x:PackageManifest/x:Metadata/x:Id
5253
([System.Xml.XmlElement]$identity.Node).SetAttribute("Version", $new.ToString())
5354
$manifest.Save($manifestFileName)
5455

56+
# Set the version in the manifest's generated code-behind file.
5557
$codeFileName = Join-Path -Path $root -ChildPath "visual-studio/source/GitWebLinks/source.extension.cs"
5658
$code = Get-Content -Path $codeFileName -Raw
5759
$code = $code -replace "public const string Version = `"[\d.]+`";", "public const string Version = `"$($new.ToString())`";"
5860
Set-Content -Path $codeFileName -Value $code -NoNewLine
5961

62+
# Set the version in the assembly info.
63+
$assemblyInfoFileName = Join-Path -Path $root -ChildPath "visual-studio/source/GitWebLinks/Properties/AssemblyInfo.cs"
64+
$assemblyInfo = Get-Content -Path $assemblyInfoFileName -Raw
65+
$assemblyInfo = $assemblyInfo -replace "Version\(`"[\d.]+`"\)", "Version(`"$($new.ToString()).0`")"
66+
Set-Content -Path $assemblyInfoFileName -Value $assemblyInfo -NoNewLine
67+
6068
Write-Host "Done"
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<Project>
2+
<ItemGroup>
3+
<PackageReference Update="Microsoft.VSSDK.BuildTools">
4+
<GeneratePathProperty>true</GeneratePathProperty>
5+
</PackageReference>
6+
</ItemGroup>
7+
8+
<Target Name="PublishToMarketplace" DependsOnTargets="Rebuild">
9+
<Message Text="Publishing extension to the marketplace..." Importance="high"/>
10+
11+
<Error
12+
Condition="'$(Configuration)' != 'Release'"
13+
Text="The configuration must be 'Release' when publishing to the marketplace."
14+
/>
15+
16+
<PropertyGroup>
17+
<VsixPublisher>$(PkgMicrosoft_VSSDK_BuildTools)\tools\vssdk\bin\VsixPublisher.exe</VsixPublisher>
18+
<PublishManifestFileName>$(MSBuildThisFileDirectory)..\publish.json</PublishManifestFileName>
19+
<ExtensionFileName>$(ProjectDir)$(TargetVsixContainer)</ExtensionFileName>
20+
</PropertyGroup>
21+
22+
<Exec
23+
Command="$(VsixPublisher) publish -personalAccessToken $(PersonalAccessToken) -payload $(ExtensionFileName) -publishManifest $(PublishManifestFileName)"
24+
StandardOutputImportance="high"
25+
StandardErrorImportance="high"
26+
LogStandardErrorAsError="true"
27+
/>
28+
29+
<Message Text="Finished publishing." Importance="high"/>
30+
</Target>
31+
</Project>

visual-studio/build/SetVsixVersion.targets

Lines changed: 0 additions & 30 deletions
This file was deleted.

visual-studio/source/GitWebLinks/GitWebLinks.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,5 +254,5 @@
254254
</ItemGroup>
255255
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
256256
<Import Project="$(VSToolsPath)\VSSDK\Microsoft.VsSDK.targets" Condition="'$(VSToolsPath)' != ''" />
257-
<Import Project="$(MSBuildThisFileDirectory)..\..\build\SetVsixVersion.targets" />
257+
<Import Project="$(MSBuildThisFileDirectory)..\..\build\PublishToMarketplace.targets" />
258258
</Project>

visual-studio/source/GitWebLinks/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,6 @@
1313
[assembly: AssemblyCulture("")]
1414
[assembly: ComVisible(false)]
1515
[assembly: NeutralResourcesLanguage("en-US")]
16-
[assembly: AssemblyVersion("1.0.0.0")]
17-
[assembly: AssemblyFileVersion("1.0.0.0")]
16+
[assembly: AssemblyVersion("2.6.1.0")]
17+
[assembly: AssemblyFileVersion("2.6.1.0")]
1818
[assembly: ThemeInfo(ResourceDictionaryLocation.None, ResourceDictionaryLocation.SourceAssembly)]

0 commit comments

Comments
 (0)