forked from MonoGame/MonoGame
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update Extension to SDK (MonoGame#8543)
Fixes MonoGame#8530 ### Description of Change - [x] Updated VS extension to SDK. (taken from Dean's Gist and tweaked) - [x] Update CI to publish extension Installing into all the VS2022 IDEs <img width="329" alt="InstallIntoVS2022" src="https://github.com/user-attachments/assets/0bb0a3a6-385b-4435-b8f9-49721e41b817">
- Loading branch information
1 parent
8a21b20
commit 8b35cf5
Showing
10 changed files
with
149 additions
and
95 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
Templates/MonoGame.Templates.VSExtension/MonoGame.Templates.VSExtension.sln
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
|
||
Microsoft Visual Studio Solution File, Format Version 12.00 | ||
# Visual Studio Version 17 | ||
VisualStudioVersion = 17.11.35327.3 | ||
MinimumVisualStudioVersion = 10.0.40219.1 | ||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MonoGame.Templates.VSExtension", "MonoGame.Templates.VSExtension.csproj", "{78561F26-117A-4D42-B177-84374B768B45}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Any CPU = Debug|Any CPU | ||
Release|Any CPU = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{78561F26-117A-4D42-B177-84374B768B45}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{78561F26-117A-4D42-B177-84374B768B45}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{78561F26-117A-4D42-B177-84374B768B45}.Debug|Any CPU.Deploy.0 = Debug|Any CPU | ||
{78561F26-117A-4D42-B177-84374B768B45}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{78561F26-117A-4D42-B177-84374B768B45}.Release|Any CPU.Build.0 = Release|Any CPU | ||
{78561F26-117A-4D42-B177-84374B768B45}.Release|Any CPU.Deploy.0 = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
GlobalSection(ExtensibilityGlobals) = postSolution | ||
SolutionGuid = {BFA7EE0A-52F0-44FA-9D7E-CC05D906A0CF} | ||
EndGlobalSection | ||
EndGlobal |
33 changes: 0 additions & 33 deletions
33
Templates/MonoGame.Templates.VSExtension/Properties/AssemblyInfo.cs
This file was deleted.
Oops, something went wrong.
61 changes: 40 additions & 21 deletions
61
Templates/MonoGame.Templates.VSExtension/source.extension.vsixmanifest
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,43 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<PackageManifest Version="2.0.0" xmlns="http://schemas.microsoft.com/developer/vsx-schema/2011" xmlns:d="http://schemas.microsoft.com/developer/vsx-schema-design/2011"> | ||
<Metadata> | ||
<Identity Version="3.8.1.1" Id="MonoGame.Templates.VSExtension.03a6f6d5-6ec0-45ff-a4f6-ec098d51464d" Language="en-US" Publisher="MonoGame" /> | ||
<DisplayName>MonoGame Framework C# project templates</DisplayName> | ||
<Description xml:space="preserve">This extension contains the C# project templates for using the MonoGame Framework</Description> | ||
<Tags>.NET,C#,Game development,Templates,Games,Gamedev,Project,Mono,MonoGame</Tags> | ||
</Metadata> | ||
<Installation> | ||
<InstallationTarget Id="Microsoft.VisualStudio.Community" Version="[17.0, 18.0)"> | ||
<ProductArchitecture>amd64</ProductArchitecture> | ||
</InstallationTarget> | ||
</Installation> | ||
<Dependencies> | ||
<Dependency Id="Microsoft.Framework.NDP" DisplayName="Microsoft .NET Framework" d:Source="Manual" Version="[4.5,)" /> | ||
</Dependencies> | ||
<Prerequisites> | ||
<Prerequisite Id="Microsoft.VisualStudio.Component.CoreEditor" Version="[17.0,18.0)" DisplayName="Visual Studio core editor" /> | ||
</Prerequisites> | ||
<Assets> | ||
<Asset Type="Microsoft.VisualStudio.VsPackage" d:Source="Project" d:ProjectName="%CurrentProject%" Path="|%CurrentProject%;PkgdefProjectOutputGroup|" /> | ||
<Asset Type="Microsoft.VisualStudio.VsPackage" d:Source="File" Path="Templates.pkgdef" /> | ||
</Assets> | ||
<Metadata> | ||
<Identity Version="3.8.2.0" Id="MonoGame.Templates.VSExtension.03a6f6d5-6ec0-45ff-a4f6-ec098d51464d" Language="en-US" Publisher="MonoGame" /> | ||
<DisplayName>MonoGame Framework C# project templates</DisplayName> | ||
<Description xml:space="preserve">This extension contains the C# project templates for using the MonoGame Framework</Description> | ||
<Tags>.NET,C#,Game development,Templates,Games,Gamedev,Project,Mono,MonoGame</Tags> | ||
</Metadata> | ||
<Installation> | ||
<InstallationTarget Version="[17.0, 18.0)" Id="Microsoft.VisualStudio.Community"> | ||
<ProductArchitecture>amd64</ProductArchitecture> | ||
</InstallationTarget> | ||
<InstallationTarget Version="[17.0, 18.0)" Id="Microsoft.VisualStudio.Pro"> | ||
<ProductArchitecture>amd64</ProductArchitecture> | ||
</InstallationTarget> | ||
<InstallationTarget Version="[17.0, 18.0)" Id="Microsoft.VisualStudio.Enterprise"> | ||
<ProductArchitecture>amd64</ProductArchitecture> | ||
</InstallationTarget> | ||
<InstallationTarget Version="[17.0, 18.0)" Id="Microsoft.VisualStudio.Community"> | ||
<ProductArchitecture>arm64</ProductArchitecture> | ||
</InstallationTarget> | ||
<InstallationTarget Version="[17.0, 18.0)" Id="Microsoft.VisualStudio.Pro"> | ||
<ProductArchitecture>arm64</ProductArchitecture> | ||
</InstallationTarget> | ||
<InstallationTarget Version="[17.0, 18.0)" Id="Microsoft.VisualStudio.Enterprise"> | ||
<ProductArchitecture>arm64</ProductArchitecture> | ||
</InstallationTarget> | ||
</Installation> | ||
<Dependencies> | ||
<Dependency Id="Microsoft.Framework.NDP" DisplayName="Microsoft .NET Framework" d:Source="Manual" Version="[4.7.2,)" /> | ||
</Dependencies> | ||
<Prerequisites> | ||
<Prerequisite Id="Microsoft.VisualStudio.Component.CoreEditor" Version="[17.0,18.0)" DisplayName="Visual Studio core editor" /> | ||
</Prerequisites> | ||
<Assets> | ||
<Asset Type="Microsoft.VisualStudio.VsPackage" d:Source="Project" d:ProjectName="%CurrentProject%" Path="|%CurrentProject%;PkgdefProjectOutputGroup|" /> | ||
<Asset Type="Microsoft.VisualStudio.VsPackage" d:Source="File" Path="Templates.pkgdef" /> | ||
<!-- This does not seem to work? --> | ||
<Asset Type="Microsoft.VisualStudio.Icon" d:Source="File" Path="../../Images/Icon.png" /> | ||
<!--Need a decent preview image --> | ||
<Asset Type="Microsoft.VisualStudio.PreviewImage" d:Source="File" Path="../../Images/Icon.png" /> | ||
</Assets> | ||
</PackageManifest> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
| ||
using System.Net.Http.Headers; | ||
using System.Text; | ||
|
||
namespace BuildScripts; | ||
|
||
[TaskName("DeployVsixToMarketplaceTask")] | ||
[IsDependentOn(typeof(DownloadArtifactsTask))] | ||
public sealed class DeployVsixToMarketplaceTask : FrostingTask<BuildContext> | ||
{ | ||
public override bool ShouldRun(BuildContext context) | ||
{ | ||
if (context.BuildSystem().IsRunningOnGitHubActions) | ||
{ | ||
var workflow = context.BuildSystem().GitHubActions.Environment.Workflow; | ||
if (workflow.RefType == GitHubActionsRefType.Tag && | ||
!string.IsNullOrWhiteSpace(context.EnvironmentVariable("MARKETPLACE_PAT"))) | ||
{ | ||
return true; | ||
} | ||
} | ||
|
||
return false; | ||
} | ||
|
||
public override async void Run(BuildContext context) | ||
{ | ||
var pat = context.EnvironmentVariable("MARKETPLACE_PAT"); | ||
var publisher = "MonoGame"; | ||
var extensionName = "MonoGame.Templates.VSExtension"; | ||
|
||
var filePath = "vsix/MonoGame.Templates.VSExtension.vsix"; | ||
if (!File.Exists(filePath)) | ||
{ | ||
context.Error("VSIX file not found!"); | ||
return; | ||
} | ||
|
||
var client = new HttpClient(); | ||
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Basic", Convert.ToBase64String(Encoding.ASCII.GetBytes($":{pat}"))); | ||
|
||
using var fileStream = File.OpenRead(filePath); | ||
using var content = new StreamContent(fileStream); | ||
content.Headers.ContentType = new MediaTypeHeaderValue("application/octet-stream"); | ||
|
||
var response = await client.PutAsync($"https://marketplace.visualstudio.com/_apis/gallery/publishers/{publisher}/vsextensions/{extensionName}/versions", content); | ||
|
||
if (response.IsSuccessStatusCode) | ||
{ | ||
context.Information("Successfully uploaded the VSIX to the Visual Studio Marketplace."); | ||
} | ||
else | ||
{ | ||
context.Error($"Failed to upload VSIX. Response: {response.StatusCode} - {response.ReasonPhrase}"); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters