Skip to content

Commit

Permalink
Vs2022 upgrade (#6)
Browse files Browse the repository at this point in the history
* Added vs2022 support

Co-authored-by: Dan Turco <[email protected]>
  • Loading branch information
d1820 and Dan Turco authored Nov 14, 2021
1 parent fd05b83 commit 49c579b
Show file tree
Hide file tree
Showing 16 changed files with 814 additions and 36 deletions.
25 changes: 16 additions & 9 deletions .github/workflows/dotnet.yml → .github/workflows/buildtest.yml
Original file line number Diff line number Diff line change
@@ -1,31 +1,28 @@
name: Build
name: GatedBuildTest

on:
push:
branches:
- main
pull_request:
branches:
- main

env:
env:
DOTNET_NOLOGO: true
DOTNET_CLI_TELEMETRY_OPTOUT: true
RepositoryUrl: 'https://github.com/${{ github.repository }}'
RepositoryBranch: '${{ github.ref }}'
SourceRevisionId: '${{ github.sha }}'
Configuration: Release
SolutionPath: ProtoAttributor.sln
Version: '1.4.${{ github.run_number }}'
SolutionPath: ProtoAttributor.sln
jobs:
build-extension:
runs-on: windows-latest
strategy:
matrix:
VsTargetVersion: ['VS2019', 'VS2022']
VsTargetVersion: ['2019', '2022']
env:
VsixManifestPath: src\Manifests\${{ matrix.VsTargetVersion }}\source.extension.vsixmanifest
VsTargetVersion: '${{ matrix.VsTargetVersion }}'
VsixManifestPath: Manifests\VS${{ matrix.VsTargetVersion }}\source.extension.vsixmanifest
VsTargetVersion: 'VS${{ matrix.VsTargetVersion }}'
steps:
- name: Checkout repository
uses: actions/checkout@v2
Expand All @@ -37,10 +34,20 @@ jobs:
uses: microsoft/[email protected]
- name: Restore NuGet Packages
run: nuget restore $env:SolutionPath
- name: Set version for Visual Studio Extension
uses: cezarypiatek/[email protected]
with:
version: ${{ env.Version }}
vsix-manifest-file: ${{ env.VsixManifestPath }}
- name: Build extension
run: msbuild $env:SolutionPath /t:Rebuild
env:
DeployExtension: False
- name: Test extension
run: dotnet test --no-build --verbosity normal $env:SolutionPath
- name: Upload VSIX artifact
uses: actions/upload-artifact@master
with:
name: VSIX-${{ matrix.VsTargetVersion }}
path: 'ProtoAttributor\bin\VS${{ matrix.VsTargetVersion }}\Release\ProtoAttributor${{ matrix.VsTargetVersion }}.vsix'

46 changes: 46 additions & 0 deletions BuildNotes.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Building for VS2019

- Open solution in vs2019
- Make any changes needed
- Run unit tests


# Building for VS2022

- Open solution in vs2022
- Make any changes needed
- Run unit tests

# Adding a new version of Visual Studio

- Create a new version folder in the Manifests folder
- Copy over vs2022\source.extension.vsixmanifest
- Make changes for new Visual Studio version
- Update ProtoAttributor proj file
- Add a new entry for target version
```XML
<VsTargetVersion Condition="'$(VsTargetVersion)' == '' and '$(VisualStudioVersion)' == '1X.0' ">VS20XX</VsTargetVersion>
```
- Add a new when clause to choose (Update XX to VS year, Update nuget packages)
```XML
<When Condition="'$(VsTargetVersion)' == 'VS20XX'">
<PropertyGroup>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<AssemblyName>ProtoAttributor20XX</AssemblyName>
</PropertyGroup>
<ItemGroup>
<None Include="..\Manifests\vs2022\source.extension.vsixmanifest" Link="source.extension.vsixmanifest">
<SubType>Designer</SubType>
</None>
<PackageReference Include="Microsoft.CodeAnalysis">
<Version>X.8.0</Version>
</PackageReference>
<PackageReference Include="Microsoft.VisualStudio.SDK" Version="1X.0.0-previews-1-31410-273" ExcludeAssets="runtime" />
<PackageReference Include="Microsoft.VSSDK.BuildTools" Version="1X.0.3177-preview3" />
</ItemGroup>
</When>
```

More Info

[migrate-vsix-to-vs2022](https://cezarypiatek.github.io/post/migrate-vsix-to-vs2022/)
33 changes: 33 additions & 0 deletions Manifests/vs2022/source.extension.vsixmanifest
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?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 Id="ProtoAttributor.2022.fc16f3d2-4cc4-42ca-a6ca-2e7fb9cb3e5f" Version="1.0" Language="en-US" Publisher="Dan Turco" />
<DisplayName>ProtoAttributor 2022</DisplayName>
<Description xml:space="preserve">ProtoAttributor is an open source Visual Studio extension that can manage the appropriate attributes on a class to support ProtoBuf. It currently supports ProtoContract, ProtoMember, ProtoIgnore, DataContract, DataMember, IgnoreDataMemeber attributes.</Description>
<MoreInfo>https://github.com/d1820/proto-attributor</MoreInfo>
<ReleaseNotes>https://github.com/d1820/proto-attributor/releases</ReleaseNotes>
<Icon>logo.png</Icon>
<PreviewImage>ProtoImagePreview.jpg</PreviewImage>
<Tags>ProtoBuf, ProtoBuf-Net, Code, Build, ReFormatting, Organizing, Attributing, Contracts, Serialization</Tags>
</Metadata>
<Installation>
<InstallationTarget Id="Microsoft.VisualStudio.Community" Version="[17.0, 18.0)">
<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>
</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|" />
</Assets>
</PackageManifest>
10 changes: 5 additions & 5 deletions ProtoAttributor.Tests/ProtoAttributor.Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<TargetFramework>net5.0</TargetFramework>

<IsPackable>false</IsPackable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="FluentAssertions" Version="5.10.3" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="3.8.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.7.1" />
<PackageReference Include="FluentAssertions" Version="6.2.0" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.0.1" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.0.0" />
<PackageReference Include="protobuf-net" Version="3.0.73" />
<PackageReference Include="xunit" Version="2.4.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="coverlet.collector" Version="1.3.0">
<PackageReference Include="coverlet.collector" Version="3.1.0">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
Expand Down
29 changes: 27 additions & 2 deletions ProtoAttributor.sln
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.30907.101
# Visual Studio Version 17
VisualStudioVersion = 17.0.31903.59
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProtoAttributor", "ProtoAttributor\ProtoAttributor.csproj", "{D166A1D7-30C3-4789-8970-FB3CF7DC9097}"
EndProject
Expand All @@ -11,9 +11,29 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
ProjectSection(SolutionItems) = preProject
.editorconfig = .editorconfig
.gitignore = .gitignore
BuildNotes.md = BuildNotes.md
README.md = README.md
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Manifests", "Manifests", "{7D0C4464-A2B6-445E-A5B3-65B56D486D5D}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "vs2019", "vs2019", "{539431F8-79AD-447C-A720-1DE69521BBB6}"
ProjectSection(SolutionItems) = preProject
Manifests\vs2019\source.extension.vsixmanifest = Manifests\vs2019\source.extension.vsixmanifest
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "vs2022", "vs2022", "{F2631D48-BF7F-4DF2-B9BC-6F698DF98F3F}"
ProjectSection(SolutionItems) = preProject
Manifests\vs2022\source.extension.vsixmanifest = Manifests\vs2022\source.extension.vsixmanifest
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".github", ".github", "{95455455-C546-4BE9-A3E9-57CD29050882}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "workflows", "workflows", "{A13BD3A5-8144-4560-BBDD-00B8D267CF5A}"
ProjectSection(SolutionItems) = preProject
.github\workflows\buildtest.yml = .github\workflows\buildtest.yml
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -32,6 +52,11 @@ Global
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{539431F8-79AD-447C-A720-1DE69521BBB6} = {7D0C4464-A2B6-445E-A5B3-65B56D486D5D}
{F2631D48-BF7F-4DF2-B9BC-6F698DF98F3F} = {7D0C4464-A2B6-445E-A5B3-65B56D486D5D}
{A13BD3A5-8144-4560-BBDD-00B8D267CF5A} = {95455455-C546-4BE9-A3E9-57CD29050882}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {20134AA9-B1A5-4C73-8A27-57F7BE492B4C}
EndGlobalSection
Expand Down
4 changes: 2 additions & 2 deletions ProtoAttributor/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,5 @@
//
// You can specify all the values or you can default the Build and Revision Numbers by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyVersion("1.4.*")]
[assembly: AssemblyFileVersion("1.4.0.0")]
72 changes: 54 additions & 18 deletions ProtoAttributor/ProtoAttributor.csproj
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<!-- STEP 1 -->
<VsTargetVersion Condition="'$(VsTargetVersion)' == '' and '$(VisualStudioVersion)' == '17.0' ">VS2022</VsTargetVersion>
<VsTargetVersion Condition="'$(VsTargetVersion)' == '' and '$(VisualStudioVersion)' == '16.0' ">VS2019</VsTargetVersion>
<!-- STEP 2 -->
<OutputPath>bin\$(VsTargetVersion)\$(Configuration)\</OutputPath>
<IntermediateOutputPath>obj\$(VsTargetVersion)\$(Configuration)\</IntermediateOutputPath>
</PropertyGroup>
<PropertyGroup>
<MinimumVisualStudioVersion>16.0</MinimumVisualStudioVersion>
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
Expand All @@ -14,8 +22,7 @@
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>ProtoAttributor</RootNamespace>
<AssemblyName>ProtoAttributor</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<!--<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>-->
<GeneratePkgDefFile>true</GeneratePkgDefFile>
<UseCodebase>true</UseCodebase>
<IncludeAssemblyInVSIXContainer>true</IncludeAssemblyInVSIXContainer>
Expand All @@ -27,19 +34,60 @@
<StartProgram Condition="'$(DevEnvDir)' != ''">$(DevEnvDir)devenv.exe</StartProgram>
<StartArguments>/rootsuffix Exp</StartArguments>
</PropertyGroup>
<!-- STEP 3 -->
<Choose>
<When Condition="'$(VsTargetVersion)' == 'VS2022'">
<PropertyGroup>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<AssemblyName>ProtoAttributor2022</AssemblyName>
</PropertyGroup>
<ItemGroup>
<None Include="..\Manifests\vs2022\source.extension.vsixmanifest" Link="source.extension.vsixmanifest">
<SubType>Designer</SubType>
</None>
<PackageReference Include="Microsoft.CodeAnalysis">
<Version>4.0.1</Version>
</PackageReference>
<PackageReference Include="Microsoft.VisualStudio.SDK" Version="17.0.31902.203" ExcludeAssets="runtime">
<IncludeAssets>compile; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.VSSDK.BuildTools" Version="17.0.5232">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
</ItemGroup>
</When>
<Otherwise>
<PropertyGroup>
<!--<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>-->
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<AssemblyName>ProtoAttributor2019</AssemblyName>
</PropertyGroup>
<ItemGroup>
<None Include="..\Manifests\vs2019\source.extension.vsixmanifest" Link="source.extension.vsixmanifest">
<SubType>Designer</SubType>
</None>
<PackageReference Include="Microsoft.CodeAnalysis">
<Version>3.8.0</Version>
</PackageReference>
<PackageReference Include="Microsoft.VisualStudio.SDK" Version="16.0.206" ExcludeAssets="runtime" />
<PackageReference Include="Microsoft.VSSDK.BuildTools" Version="16.8.3038" />
</ItemGroup>
</Otherwise>
</Choose>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<!--<OutputPath>bin\Debug\</OutputPath>-->
<DefineConstants>TRACE;DEBUG</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<!--<OutputPath>bin\Release\</OutputPath>-->
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
Expand Down Expand Up @@ -79,11 +127,6 @@
<Compile Include="Services\ProtoAttributeService.cs" />
<Compile Include="Services\IAttributeService.cs" />
</ItemGroup>
<ItemGroup>
<None Include="source.extension.vsixmanifest">
<SubType>Designer</SubType>
</None>
</ItemGroup>
<ItemGroup>
<Reference Include="Microsoft.CSharp" />
<Reference Include="System" />
Expand All @@ -93,13 +136,6 @@
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.CodeAnalysis">
<Version>3.8.0</Version>
</PackageReference>
<PackageReference Include="Microsoft.VisualStudio.SDK" Version="16.0.206" ExcludeAssets="runtime" />
<PackageReference Include="Microsoft.VSSDK.BuildTools" Version="16.8.3038" />
</ItemGroup>
<ItemGroup>
<VSCTCompile Include="ProtoAttributorPackage.vsct">
<ResourceName>Menus.ctmenu</ResourceName>
Expand All @@ -121,7 +157,7 @@
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="$(VSToolsPath)\VSSDK\Microsoft.VsSDK.targets" Condition="'$(VSToolsPath)' != ''" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
Expand Down
25 changes: 25 additions & 0 deletions ProtoAttributorTestShell/ProtoAttributorTestShell.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.30011.22
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ProtoAttributorTestShell", "ProtoAttributorTestShell\ProtoAttributorTestShell.csproj", "{A05E9BA1-3097-42CD-8291-EA30D3179FFE}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{A05E9BA1-3097-42CD-8291-EA30D3179FFE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A05E9BA1-3097-42CD-8291-EA30D3179FFE}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A05E9BA1-3097-42CD-8291-EA30D3179FFE}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A05E9BA1-3097-42CD-8291-EA30D3179FFE}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {9048D1DE-16B4-4F22-B86E-32B077847C49}
EndGlobalSection
EndGlobal
Loading

0 comments on commit 49c579b

Please sign in to comment.