Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for Visual Studio 2022 #360

Merged
merged 5 commits into from Jan 26, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/pull_request_template.md
Expand Up @@ -13,4 +13,5 @@ Fixes # (issue)
* [ ] New and existing unit tests pass locally with my changes
* [ ] I have tested my changes by running the extension in VS2017
* [ ] I have tested my changes by running the extension in VS2019
* [ ] I have tested my changes by running the extension in VS2022
* [ ] If changes to the [documentation](https://github.com/Xavalon/XamlStyler/wiki) are needed, I have noted this in the description above
File renamed without changes.
39 changes: 39 additions & 0 deletions build/extension-manifest-vs2022.json
@@ -0,0 +1,39 @@
{
"$schema": "http://json.schemastore.org/vsix-publish",
"categories": [
"coding",
"other",
"programming languages"
],
"identity": {
"internalName": "XAMLStyler2022",
"tags": [
"beautifier",
"beautify",
"cleaning",
"cleanup",
"code",
"code formatting",
"code quality",
"format",
"formatter",
"formatting",
"pretty",
"reorganizing",
"style",
"styler",
"uwp",
"wpf",
"xamarin",
"xaml",
"xaml styler",
"xaml-styler",
]
},
"overview": "./extension-overview.md",
"priceCategory": "free",
"publisher": "TeamXavalon",
"private": false,
"qna": false,
"repo": "https://github.com/Xavalon/XamlStyler"
}
4 changes: 4 additions & 0 deletions build/extension-overview.md
@@ -1,5 +1,9 @@
XAML Styler is a visual studio extension that formats XAML source code based on a set of styling rules. This tool can help you/your team maintain a better XAML coding style as well as a much better XAML readability.

**Using Visual Studio 2022?** [Download XAML Styler for Visual Studio 2022](https://marketplace.visualstudio.com/items?itemName=TeamXavalon.XAMLStyler2022)

**Using Visual Studio 2017 or 2019?** [Download XAML Styler](https://marketplace.visualstudio.com/items?itemName=TeamXavalon.XAMLStyler)

|[Documentation](https://github.com/Xavalon/XamlStyler/wiki)|[Script Integration](https://github.com/Xavalon/XamlStyler/wiki/Script-Integration)|[Release Notes](https://github.com/Xavalon/XamlStyler/wiki/Release-Notes)|[Contributing](https://github.com/Xavalon/XamlStyler/blob/master/CONTRIBUTING.md)|
|---|---|---|---|

Expand Down
3 changes: 2 additions & 1 deletion build/pipelines/templates/build-extension-public.yaml
Expand Up @@ -44,7 +44,8 @@ jobs:
inputs:
contents: |
build/extension-overview.md
build/extension-manifest.json
build/extension-manifest-vs2019.json
build/extension-manifest-vs2022.json
**/*.vsix
targetFolder: $(Build.ArtifactStagingDirectory)
cleanTargetFolder: true
Expand Down
2 changes: 2 additions & 0 deletions build/pipelines/templates/build-extension-rider-public.yaml
Expand Up @@ -9,6 +9,8 @@ jobs:
variables:
pluginVersion: $(Build.BuildNumber)

continueOnError: true

steps:
- task: NuGetToolInstaller@1
displayName: 'Install NuGet Tools'
Expand Down
6 changes: 4 additions & 2 deletions build/update-version.ps1
Expand Up @@ -80,9 +80,11 @@ function Update-AssemblyInfo {
Set-Content $AssemblyInfoPath $content
}

Update-VSIXManifest -VSIXManifestPath $(Resolve-Path $PSScriptRoot\..\src\XamlStyler.Extension.Windows\source.extension.vsixmanifest)
Update-VSIXManifest -VSIXManifestPath $(Resolve-Path $PSScriptRoot\..\src\XamlStyler.Extension.Windows.VS2019\source.extension.vsixmanifest)
Update-VSIXManifest -VSIXManifestPath $(Resolve-Path $PSScriptRoot\..\src\XamlStyler.Extension.Windows.VS2022\source.extension.vsixmanifest)
Update-CSProj -CSProjPath $(Resolve-Path $PSScriptRoot\..\src\XamlStyler\XamlStyler.csproj)
Update-CSProj -CSProjPath $(Resolve-Path $PSScriptRoot\..\src\XamlStyler.Extension\XamlStyler.Extension.csproj)
Update-CSProj -CSProjPath $(Resolve-Path $PSScriptRoot\..\src\XamlStyler.Console\XamlStyler.Console.csproj) -UpdatePackageVersion
Update-AssemblyInfo -AssemblyInfoPath $(Resolve-Path $PSScriptRoot\..\src\XamlStyler.Extension.Windows\Properties\AssemblyInfo.cs)
Update-AssemblyInfo -AssemblyInfoPath $(Resolve-Path $PSScriptRoot\..\src\XamlStyler.Extension.Windows.VS2019\Properties\AssemblyInfo.cs)
Update-AssemblyInfo -AssemblyInfoPath $(Resolve-Path $PSScriptRoot\..\src\XamlStyler.Extension.Windows.VS2022\Properties\AssemblyInfo.cs)
Update-AssemblyInfo -AssemblyInfoPath $(Resolve-Path $PSScriptRoot\..\src\XamlStyler.Extension.Mac\Properties\AssemblyInfo.cs)
2 changes: 1 addition & 1 deletion src/XamlStyler.Console/XamlStyler.Console.csproj
Expand Up @@ -31,7 +31,7 @@
<PackageReference Include="CommandLineParser">
<Version>2.6.0</Version>
</PackageReference>
<PackageReference Include="Microsoft.CodeAnalysis.FxCopAnalyzers" Version="2.6.3">
<PackageReference Include="Microsoft.CodeAnalysis.NetAnalyzers" Version="6.0.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
Expand Down
Expand Up @@ -89,27 +89,27 @@ private void AddCommandHandlers()
new CommandID(Guids.GuidXamlStylerMenuSet, (int)Constants.CommandIDFormatSelectedXaml)));

// File.Save Command
this.saveCommandEvents = this.IDE.Events.CommandEvents[$"{{{Guids.GuidVsStd97CmdIDString}}}", 331];
this.saveCommandEvents = this.IDE2.Events.CommandEvents[$"{{{Guids.GuidVsStd97CmdIDString}}}", 331];
this.saveCommandEvents.BeforeExecute += this.OnFileSave;

// File.SaveAll Command
this.saveAllCommandEvents = this.IDE.Events.CommandEvents[$"{{{Guids.GuidVsStd97CmdIDString}}}", 224];
this.saveAllCommandEvents = this.IDE2.Events.CommandEvents[$"{{{Guids.GuidVsStd97CmdIDString}}}", 224];
this.saveAllCommandEvents.BeforeExecute += this.OnFileSaveAll;
}

private void FormatFileEventHandler()
{
ThreadHelper.ThrowIfNotOnUIThread();
this.uiShell.SetWaitCursor();
this.FormatDocument(this.IDE.ActiveDocument);
this.FormatDocument(this.IDE2.ActiveDocument);
}

private void FormatSolutionEventHandler()
{
ThreadHelper.ThrowIfNotOnUIThread();
this.uiShell.SetWaitCursor();

IEnumerable<ProjectItem> projectItems = ProjectItemHelper.GetAllProjectItems(this.IDE.Solution)
IEnumerable<ProjectItem> projectItems = ProjectItemHelper.GetAllProjectItems(this.IDE2.Solution)
.Where(_ => _.IsXaml() && _.IsFormatable());

this.FormatDocuments(projectItems);
Expand All @@ -135,7 +135,7 @@ private void OnFileSave(string guid, int id, object customIn, object customOut,
return;
}

Document document = this.IDE.ActiveDocument;
Document document = this.IDE2.ActiveDocument;
IStylerOptions options = this.optionsHelper.GetDocumentStylerOptions(document);
if (options.FormatOnSave)
{
Expand All @@ -154,7 +154,7 @@ private void OnFileSaveAll(string guid, int id, object customIn, object customOu

// Use parallel processing, but only on the documents that are formatable (to avoid the overhead of Task creating when it's not necessary).
var jobs = new List<Func<Action>>();
foreach (Document document in this.IDE.Documents)
foreach (Document document in this.IDE2.Documents)
{
// Skip unopened documents.
if (document.ActiveWindow != null)
Expand Down
Expand Up @@ -143,6 +143,6 @@
<value>StylerPackage Visual Stuido Extension Detailed Info</value>
</data>
<data name="1400" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>Resources\StylerPackage.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
<value>..\XamlStyler.Extension.Windows.Shared\Resources\StylerPackage.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
</root>
@@ -0,0 +1,40 @@
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<MSBuildAllProjects Condition="'$(MSBuildVersion)' == '' Or '$(MSBuildVersion)' &lt; '16.0'">$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects>
<HasSharedItems>true</HasSharedItems>
<SharedGUID>01231f73-66ef-4f3e-8dfd-95bf935bf8eb</SharedGUID>
</PropertyGroup>
<PropertyGroup Label="Configuration">
<Import_RootNamespace>XamlStyler.Extension.Windows.Shared</Import_RootNamespace>
</PropertyGroup>
<ItemGroup>
<Compile Include="$(MSBuildThisFileDirectory)Constants.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Extensions\DocumentExtensions.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Extensions\ProjectItemExtensions.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Extensions\StringExtensions.cs" />
<Compile Include="$(MSBuildThisFileDirectory)GlobalSuppressions.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Guids.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Helpers\OptionsHelper.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Helpers\ProjectItemHelper.cs" />
<Compile Include="$(MSBuildThisFileDirectory)PackageOptions.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="$(MSBuildThisFileDirectory)StylerPackage.cs" />
<Compile Include="$(MSBuildThisFileDirectory)StylerPackage.Formatting.cs">
<DependentUpon>StylerPackage.cs</DependentUpon>
</Compile>
</ItemGroup>
<ItemGroup>
<None Include="$(MSBuildThisFileDirectory)Key.snk" />
</ItemGroup>
<ItemGroup>
<Resource Include="$(MSBuildThisFileDirectory)Resources\format.png" />
<Resource Include="$(MSBuildThisFileDirectory)Resources\StylerPackage.ico" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="$(MSBuildThisFileDirectory)VSPackage.resx">
<SubType>Designer</SubType>
</EmbeddedResource>
</ItemGroup>
</Project>
@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Label="Globals">
<ProjectGuid>01231f73-66ef-4f3e-8dfd-95bf935bf8eb</ProjectGuid>
<MinimumVisualStudioVersion>14.0</MinimumVisualStudioVersion>
</PropertyGroup>
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\CodeSharing\Microsoft.CodeSharing.Common.Default.props" />
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\CodeSharing\Microsoft.CodeSharing.Common.props" />
<PropertyGroup />
<Import Project="XamlStyler.Extension.Windows.Shared.projitems" Label="Shared" />
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\CodeSharing\Microsoft.CodeSharing.CSharp.targets" />
</Project>
Expand Up @@ -6,12 +6,12 @@
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("XamlStyler.Extension.Windows")]
[assembly: AssemblyTitle("XamlStyler.Extension.Windows.VS2019")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Xavalon")]
[assembly: AssemblyProduct("XamlStyler.Extension.Windows")]
[assembly: AssemblyCopyright("Copyright © Xavalon 2020")]
[assembly: AssemblyProduct("XamlStyler.Extension.Windows.VS2019")]
[assembly: AssemblyCopyright("Copyright © Xavalon 2021")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
Expand Down
Expand Up @@ -27,9 +27,10 @@
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Xavalon.XamlStyler.Extension.Windows</RootNamespace>
<AssemblyName>XamlStyler.Extension.Windows</AssemblyName>
<AssemblyName>XamlStyler.Extension.Windows.VS2019</AssemblyName>
<SignAssembly>True</SignAssembly>
<AssemblyOriginatorKeyFile>Key.snk</AssemblyOriginatorKeyFile>
<AssemblyOriginatorKeyFile>
</AssemblyOriginatorKeyFile>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<RunCodeAnalysis>false</RunCodeAnalysis>
</PropertyGroup>
Expand All @@ -49,113 +50,55 @@
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>..\bin\Release\Extension.Windows\</OutputPath>
<OutputPath>..\bin\Release\Extension.Windows.VS2019\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<DeployExtension>false</DeployExtension>
<RunCodeAnalysis>false</RunCodeAnalysis>
</PropertyGroup>
<ItemGroup>
<Compile Include="Constants.cs" />
<Compile Include="Extensions\ProjectItemExtensions.cs" />
<Compile Include="Extensions\DocumentExtensions.cs" />
<Compile Include="Extensions\StringExtensions.cs" />
<Compile Include="Guids.cs" />
<Compile Include="Helpers\OptionsHelper.cs" />
<Compile Include="PackageOptions.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<Compile Include="GlobalSuppressions.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Helpers\ProjectItemHelper.cs" />
<Compile Include="StylerPackage.cs" />
<Compile Include="StylerPackage.Formatting.cs">
<DependentUpon>StylerPackage.cs</DependentUpon>
</Compile>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="VSPackage.resx">
<MergeWithCTO>true</MergeWithCTO>
<ManifestResourceName>VSPackage</ManifestResourceName>
<SubType>Designer</SubType>
</EmbeddedResource>
<Content Include="..\..\LICENSE">
<Link>LICENSE</Link>
<IncludeInVSIX>true</IncludeInVSIX>
</Content>
<Content Include="Resources\icon128.jpg">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
<IncludeInVSIX>true</IncludeInVSIX>
</Content>
<Content Include="Resources\icon200.jpg">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
<IncludeInVSIX>true</IncludeInVSIX>
</Content>
</ItemGroup>
<ItemGroup>
<None Include="source.extension.vsixmanifest">
<SubType>Designer</SubType>
</None>
</ItemGroup>
<ItemGroup>
<None Include="Key.snk" />
</ItemGroup>
<ItemGroup>
<VSCTCompile Include="XamlStyler.Package.vsct">
<ResourceName>Menus.ctmenu</ResourceName>
<SubType>Designer</SubType>
</VSCTCompile>
</ItemGroup>
<ItemGroup>
<Resource Include="Resources\format.png" />
<Content Include="Resources\icon128.jpg">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
<IncludeInVSIX>true</IncludeInVSIX>
</Content>
<Content Include="LICENSE.txt">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
<IncludeInVSIX>true</IncludeInVSIX>
</Content>
<Content Include="Resources\icon200.jpg">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
<IncludeInVSIX>true</IncludeInVSIX>
</Content>
<Resource Include="Resources\StylerPackage.ico" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="CompareNETObjects">
<Version>3.5.0</Version>
</PackageReference>
<PackageReference Include="EnvDTE">
<Version>8.0.2</Version>
</PackageReference>
<PackageReference Include="EnvDTE80">
<Version>8.0.3</Version>
</PackageReference>
<PackageReference Include="Microsoft.CodeAnalysis.FxCopAnalyzers">
<Version>2.6.3</Version>
<PackageReference Include="Microsoft.CodeAnalysis.NetAnalyzers">
<Version>6.0.0</Version>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="Microsoft.VisualStudio.Imaging">
<Version>15.0.26201</Version>
</PackageReference>
<PackageReference Include="Microsoft.VisualStudio.SDK.Analyzers">
<Version>15.8.33</Version>
</PackageReference>
<PackageReference Include="Microsoft.VisualStudio.Shell.15.0">
<Version>15.0.25901-RC</Version>
</PackageReference>
<PackageReference Include="Microsoft.VisualStudio.Shell.Interop.12.0">
<Version>12.0.30111</Version>
</PackageReference>
<PackageReference Include="Microsoft.VisualStudio.Threading">
<Version>15.0.240</Version>
</PackageReference>
<PackageReference Include="Microsoft.VisualStudio.Threading.Analyzers">
<Version>15.8.122</Version>
<PackageReference Include="Microsoft.VisualStudio.SDK">
<Version>15.0.1</Version>
</PackageReference>
<PackageReference Include="Microsoft.VSSDK.BuildTools">
<Version>15.9.3032</Version>
<Version>17.0.5232</Version>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
Expand All @@ -174,6 +117,7 @@
<Name>XamlStyler</Name>
</ProjectReference>
</ItemGroup>
<Import Project="..\XamlStyler.Extension.Windows.Shared\XamlStyler.Extension.Windows.Shared.projitems" Label="Shared" />
<PropertyGroup>
<UseCodebase>true</UseCodebase>
</PropertyGroup>
Expand Down
Expand Up @@ -124,7 +124,7 @@

<!-- The bitmaps section is used to define the bitmaps that are used for the commands. -->
<Bitmaps>
<Bitmap guid="GuidImageFormat" href="Resources\format.png" usedList="IconFormat"/>
<Bitmap guid="GuidImageFormat" href="..\XamlStyler.Extension.Windows.Shared\Resources\format.png" usedList="IconFormat"/>
</Bitmaps>
</Commands>

Expand Down