Skip to content

Commit

Permalink
Migrate to .NET 6 (#68)
Browse files Browse the repository at this point in the history
Co-authored-by: Igor Velikorossov <[email protected]>

Fixes #67
  • Loading branch information
maraf authored Dec 13, 2022
1 parent 4e3ba18 commit 3b53e6e
Show file tree
Hide file tree
Showing 21 changed files with 342 additions and 94 deletions.
188 changes: 188 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,188 @@
# editorconfig.org

# top-most EditorConfig file
root = true

# Default settings:
# A newline ending every file
# Use 4 spaces as indentation
[*]
guidelines = 120 1px dotted 504CFF00, 150 1px dotted 50FF6A00
indent_style = space
indent_size = 4

[*.json]
indent_size = 2

# C# and VB files
[*.{cs,vb}]
charset = utf-8-bom
insert_final_newline = true
trim_trailing_whitespace = true

# avoid this. unless absolutely necessary
dotnet_style_qualification_for_field = false:suggestion
dotnet_style_qualification_for_property = false:suggestion
dotnet_style_qualification_for_method = false:suggestion
dotnet_style_qualification_for_event = false:suggestion
# use language keywords instead of BCL types
dotnet_style_predefined_type_for_locals_parameters_members = true:suggestion
dotnet_style_predefined_type_for_member_access = true:suggestion

# name all constant fields using PascalCase
dotnet_naming_rule.constant_fields_should_be_pascal_case.severity = suggestion
dotnet_naming_rule.constant_fields_should_be_pascal_case.symbols = constant_fields
dotnet_naming_rule.constant_fields_should_be_pascal_case.style = pascal_case_style

dotnet_naming_symbols.constant_fields.applicable_kinds = field
dotnet_naming_symbols.constant_fields.required_modifiers = const

dotnet_naming_style.pascal_case_style.capitalization = pascal_case

# static fields should have s_ prefix
dotnet_naming_rule.static_fields_should_have_prefix.severity = suggestion
dotnet_naming_rule.static_fields_should_have_prefix.symbols = static_fields
dotnet_naming_rule.static_fields_should_have_prefix.style = static_prefix_style

dotnet_naming_symbols.static_fields.applicable_kinds = field
dotnet_naming_symbols.static_fields.required_modifiers = static

dotnet_naming_style.static_prefix_style.required_prefix = s_
dotnet_naming_style.static_prefix_style.capitalization = camel_case

# internal and private fields should be _camelCase
dotnet_naming_rule.camel_case_for_private_internal_fields.severity = suggestion
dotnet_naming_rule.camel_case_for_private_internal_fields.symbols = private_internal_fields
dotnet_naming_rule.camel_case_for_private_internal_fields.style = camel_case_underscore_style

dotnet_naming_symbols.private_internal_fields.applicable_kinds = field
dotnet_naming_symbols.private_internal_fields.applicable_accessibilities = private, internal

dotnet_naming_style.camel_case_underscore_style.required_prefix = _
dotnet_naming_style.camel_case_underscore_style.capitalization = camel_case

# Code style defaults
dotnet_sort_system_directives_first = true

# Expression-level preferences
dotnet_style_object_initializer = true:suggestion
dotnet_style_collection_initializer = true:suggestion
dotnet_style_explicit_tuple_names = true:suggestion
dotnet_style_coalesce_expression = true:suggestion
dotnet_style_null_propagation = true:suggestion

# C# files
[*.cs]

# .NET diagnostic
dotnet_diagnostic.RS0041.severity = none
dotnet_diagnostic.IDE0005.severity = warning

# New line preferences
csharp_new_line_before_open_brace = all
csharp_new_line_before_else = true
csharp_new_line_before_catch = true
csharp_new_line_before_finally = true
csharp_new_line_before_members_in_object_initializers = true
csharp_new_line_before_members_in_anonymous_types = true
csharp_new_line_between_query_expression_clauses = true

# Indentation preferences
csharp_indent_block_contents = true
csharp_indent_braces = false
csharp_indent_case_contents = true
csharp_indent_switch_labels = true
csharp_indent_labels = one_less_than_current

# only use var when it's obvious what the variable type is
csharp_style_var_for_built_in_types = false:silent
csharp_style_var_when_type_is_apparent = true:silent
csharp_style_var_elsewhere = false:silent

# Code style defaults
csharp_preserve_single_line_blocks = true
csharp_preserve_single_line_statements = false

# Expression-bodied members
csharp_style_expression_bodied_methods = false:none
csharp_style_expression_bodied_constructors = false:none
csharp_style_expression_bodied_operators = false:none
csharp_style_expression_bodied_properties = true:none
csharp_style_expression_bodied_indexers = true:none
csharp_style_expression_bodied_accessors = true:none

# Pattern matching
csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion
csharp_style_pattern_matching_over_as_with_null_check = true:suggestion
csharp_style_inlined_variable_declaration = true:suggestion

# Null checking preferences
csharp_style_throw_expression = true:suggestion
csharp_style_conditional_delegate_call = true:suggestion

# Space preferences
csharp_space_after_cast = false
csharp_space_after_colon_in_inheritance_clause = true
csharp_space_after_comma = true
csharp_space_after_dot = false
csharp_space_after_keywords_in_control_flow_statements = true
csharp_space_after_semicolon_in_for_statement = true
csharp_space_around_binary_operators = before_and_after
csharp_space_around_declaration_statements = do_not_ignore
csharp_space_before_colon_in_inheritance_clause = true
csharp_space_before_comma = false
csharp_space_before_dot = false
csharp_space_before_open_square_brackets = false
csharp_space_before_semicolon_in_for_statement = false
csharp_space_between_empty_square_brackets = false
csharp_space_between_method_call_empty_parameter_list_parentheses = false
csharp_space_between_method_call_name_and_opening_parenthesis = false
csharp_space_between_method_call_parameter_list_parentheses = false
csharp_space_between_method_declaration_empty_parameter_list_parentheses = false
csharp_space_between_method_declaration_name_and_open_parenthesis = false
csharp_space_between_method_declaration_parameter_list_parentheses = false
csharp_space_between_parentheses = false
csharp_space_between_square_brackets = false

# IDE0008: Use explicit type
dotnet_diagnostic.IDE0008.severity = silent

# Visual Basic files

[*.vb]
# Modifier preferences
visual_basic_preferred_modifier_order = Partial,Default,Private,Protected,Public,Friend,NotOverridable,Overridable,MustOverride,Overloads,Overrides,MustInherit,NotInheritable,Static,Shared,Shadows,ReadOnly,WriteOnly,Dim,Const,WithEvents,Widening,Narrowing,Custom,Async:suggestion

# C++ Files
[*.{cpp,h,in}]
curly_bracket_next_line = true
indent_brace_style = Allman

# Xml project files
[*.{csproj,vbproj,vcxproj,vcxproj.filters,proj,nativeproj,locproj}]
indent_size = 2

# Xml build files
[*.builds]
indent_size = 2

# Xml files
[*.{xml,stylecop,ruleset}]
indent_size = 2

# Xml config files
[*.{props,targets,config,nuspec}]
indent_size = 2

# resx Files
[*.{resx,xlf}]
indent_size = 2
charset = utf-8-bom
insert_final_newline = true

# Shell scripts
[*.sh]
end_of_line = lf

[*.{cmd,bat}]
end_of_line = crlf
36 changes: 22 additions & 14 deletions src/Directory.Build.props → Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,14 +1,22 @@
<!-- Do not use XML namespaces here (<Project xmlns="...">), because it would break patching of version numbers during builds on AppVeyor (https://github.com/appveyor/website/pull/409) -->
<Project>
<PropertyGroup>
<Authors>Git Extensions</Authors>
<Company>Git Extensions</Company>
<RepositoryUrl>https://github.com/gitextensions/gitextensions.pluginmanager</RepositoryUrl>
<LangVersion>latest</LangVersion>
<Version>0.0.0</Version>
<AssemblyVersion>0.0.0.1</AssemblyVersion>
<FileVersion>0.0.0.1</FileVersion>
<InformationalVersion>0.0.0.1</InformationalVersion>
<PackageVersion>0.0.0.1</PackageVersion>
</PropertyGroup>
</Project>
<Project>

<PropertyGroup>
<TargetFramework>net6.0-windows</TargetFramework>
<LangVersion>latest</LangVersion>
<NoWarn>$(NoWarn);1573;1591;1712</NoWarn>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
</PropertyGroup>

<PropertyGroup>
<Authors>Git Extensions</Authors>
<Company>Git Extensions</Company>
<RepositoryUrl>https://github.com/gitextensions/gitextensions.pluginmanager</RepositoryUrl>
<LangVersion>latest</LangVersion>
<Version>0.0.0</Version>
<AssemblyVersion>0.0.0.1</AssemblyVersion>
<FileVersion>0.0.0.1</FileVersion>
<InformationalVersion>0.0.0.1</InformationalVersion>
<PackageVersion>0.0.0.1</PackageVersion>
</PropertyGroup>

</Project>
5 changes: 5 additions & 0 deletions Directory.Build.targets
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<Project>

<Sdk Name="Microsoft.Build.CentralPackageVersions" Version="2.1.3" />

</Project>
37 changes: 30 additions & 7 deletions GitExtensions.PluginManager.sln
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.27703.2000
# Visual Studio Version 17
VisualStudioVersion = 17.5.33130.490
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GitExtensions.PluginManager", "src\GitExtensions.PluginManager\GitExtensions.PluginManager.csproj", "{4EB0566E-6D4F-43AF-AA97-2A15ABB66787}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PackageManager.UI", "src\PackageManager.UI\PackageManager.UI.csproj", "{6F4FA02A-B061-4607-925E-27B122DE60BC}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PackageManager.UI", "src\PackageManager.UI\PackageManager.UI.csproj", "{6F4FA02A-B061-4607-925E-27B122DE60BC}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PackageManager", "src\PackageManager\PackageManager.csproj", "{3B5E3720-B3CB-4A12-B2D4-6BCB6BE78FF1}"
EndProject
Expand All @@ -18,13 +18,35 @@ EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "PackageManager.NuGet.Tests", "test\PackageManager.NuGet.Tests\PackageManager.NuGet.Tests.csproj", "{7EE3B4B1-0BAA-4EB3-BBCB-30BEA09019A3}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tests", "Tests", "{7184D694-3B8B-4C4D-BD6E-7EBF73AB9CCA}"
ProjectSection(SolutionItems) = preProject
test\Directory.Build.props = test\Directory.Build.props
test\Directory.Build.targets = test\Directory.Build.targets
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{FA57D002-774F-432E-AE8E-09B7690EF0CC}"
ProjectSection(SolutionItems) = preProject
.editorconfig = .editorconfig
.gitignore = .gitignore
appveyor.yml = appveyor.yml
Directory.Build.props = Directory.Build.props
Directory.Build.targets = Directory.Build.targets
GitExtensions.settings = GitExtensions.settings
Packages.props = Packages.props
README.md = README.md
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{B13A9C49-3262-4F06-B929-FB46D10A4820}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{4EB0566E-6D4F-43AF-AA97-2A15ABB66787}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{4EB0566E-6D4F-43AF-AA97-2A15ABB66787}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4EB0566E-6D4F-43AF-AA97-2A15ABB66787}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4EB0566E-6D4F-43AF-AA97-2A15ABB66787}.Release|Any CPU.Build.0 = Release|Any CPU
{6F4FA02A-B061-4607-925E-27B122DE60BC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{6F4FA02A-B061-4607-925E-27B122DE60BC}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6F4FA02A-B061-4607-925E-27B122DE60BC}.Release|Any CPU.ActiveCfg = Release|Any CPU
Expand All @@ -37,10 +59,6 @@ Global
{B302D166-37CE-439D-8AE1-0CCB80BAD332}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B302D166-37CE-439D-8AE1-0CCB80BAD332}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B302D166-37CE-439D-8AE1-0CCB80BAD332}.Release|Any CPU.Build.0 = Release|Any CPU
{4EB0566E-6D4F-43AF-AA97-2A15ABB66787}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{4EB0566E-6D4F-43AF-AA97-2A15ABB66787}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4EB0566E-6D4F-43AF-AA97-2A15ABB66787}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4EB0566E-6D4F-43AF-AA97-2A15ABB66787}.Release|Any CPU.Build.0 = Release|Any CPU
{72134702-9CC0-408F-9E07-B4D59C9D7E43}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{72134702-9CC0-408F-9E07-B4D59C9D7E43}.Debug|Any CPU.Build.0 = Debug|Any CPU
{72134702-9CC0-408F-9E07-B4D59C9D7E43}.Release|Any CPU.ActiveCfg = Release|Any CPU
Expand All @@ -58,7 +76,12 @@ Global
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{4EB0566E-6D4F-43AF-AA97-2A15ABB66787} = {B13A9C49-3262-4F06-B929-FB46D10A4820}
{6F4FA02A-B061-4607-925E-27B122DE60BC} = {B13A9C49-3262-4F06-B929-FB46D10A4820}
{3B5E3720-B3CB-4A12-B2D4-6BCB6BE78FF1} = {B13A9C49-3262-4F06-B929-FB46D10A4820}
{B302D166-37CE-439D-8AE1-0CCB80BAD332} = {B13A9C49-3262-4F06-B929-FB46D10A4820}
{72134702-9CC0-408F-9E07-B4D59C9D7E43} = {7184D694-3B8B-4C4D-BD6E-7EBF73AB9CCA}
{E7AD4376-D8B1-469D-A2E3-38059A5EB152} = {B13A9C49-3262-4F06-B929-FB46D10A4820}
{7EE3B4B1-0BAA-4EB3-BBCB-30BEA09019A3} = {7184D694-3B8B-4C4D-BD6E-7EBF73AB9CCA}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
Expand Down
22 changes: 22 additions & 0 deletions Packages.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<Project>

<ItemGroup>
<PackageReference Update="GitExtensions.Extensibility" Version="0.3.*" />
<PackageReference Update="Neptuo" Version="6.0.2" />
<PackageReference Update="Neptuo.Exceptions" Version="1.2.2" />
<PackageReference Update="Neptuo.Observables" Version="2.1.1" />
<PackageReference Update="NuGet.PackageManagement" Version="6.3.1" />
<PackageReference Update="System.ComponentModel.Composition" Version="6.0.0" />
<PackageReference Update="System.Resources.Extensions" Version="6.0.0" />
</ItemGroup>

<!-- Test-related -->
<ItemGroup>
<PackageReference Update="Microsoft.NET.Test.Sdk" Version="17.4.0" />
<PackageReference Update="Moq" Version="4.18.2" />
<PackageReference Update="MSTest.TestAdapter" Version="2.2.10" />
<PackageReference Update="MSTest.TestFramework" Version="2.2.10" />
<PackageReference Update="Appveyor.TestLogger" Version="2.0.0" />
</ItemGroup>

</Project>
4 changes: 2 additions & 2 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#---------------------------------#

# version format
version: 2.0.0.{build}
version: 3.0.0.{build}

# version suffix, if any (e.g. '-RC1', '-beta' otherwise '')
environment:
Expand All @@ -18,7 +18,7 @@ skip_tags: true

# Build worker image (VM template)
image:
- Visual Studio 2019
- Visual Studio 2022

# enable patching of Directory.Build.props
dotnet_csproj:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,26 +1,25 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net5.0-windows</TargetFramework>
<UseWindowsForms>true</UseWindowsForms>
<Description>NuGet-based Plugin Manager for Git Extensions</Description>
<PackageTags>GitExtensions</PackageTags>
<PackageProjectUrl>https://github.com/gitextensions/gitextensions.pluginmanager</PackageProjectUrl>
<RunPostBuildEvent>OnOutputUpdated</RunPostBuildEvent>
<NuspecFile>$(MSBuildThisFileDirectory)$(MSBuildProjectName).nuspec</NuspecFile>
<NoWarn>1701;1702;NU5100</NoWarn>
<NoWarn>1701;1702;NU5100;NU5101;NU5103;NU5128</NoWarn>
</PropertyGroup>

<PropertyGroup>
<PackageManagerTargetPath>PackageManager\PackageManager.UI.exe</PackageManagerTargetPath>
<PackageManagerSourcePath>..\PackageManager.UI\bin\Release\$(TargetFramework)\publish\PackageManager.UI.exe</PackageManagerSourcePath>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<PackageManagerSourcePath>..\PackageManager.UI\bin\$(Configuration)\$(TargetFramework)\publish\PackageManager.UI.exe</PackageManagerSourcePath>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="GitExtensions.Extensibility" Version="0.2.*" />
<PackageReference Include="System.ComponentModel.Composition" Version="5.0.0" />
<PackageReference Include="System.Resources.Extensions" Version="4.6.0" />
<PackageReference Include="GitExtensions.Extensibility" />
<PackageReference Include="System.ComponentModel.Composition" />
<PackageReference Include="System.Resources.Extensions" />
</ItemGroup>

<ItemGroup>
Expand All @@ -42,7 +41,7 @@
<ItemGroup>
<ProjectReference Include="..\PackageManager.UI\PackageManager.UI.csproj" ReferenceOutputAssembly="false" />
</ItemGroup>

<ItemGroup>
<Compile Update="Properties\Resources.Designer.cs">
<DesignTime>True</DesignTime>
Expand All @@ -59,6 +58,7 @@
<Copy SourceFiles="$(PackageManagerSourcePath)" DestinationFiles="$(TargetDir)$(PackageManagerTargetPath)" />
<Copy SourceFiles="$(PackageManagerSourcePath)" DestinationFiles="$(GitExtensionsPluginsPath)\$(ProjectName)\$(PackageManagerTargetPath)" />
</Target>

<Target Name="PreClean" BeforeTargets="Clean">
<Message Text="Deleting PackageManager" Importance="high" />
<Delete Files="$(TargetDir)$(PackageManagerTargetPath)" ContinueOnError="true" />
Expand Down
Loading

0 comments on commit 3b53e6e

Please sign in to comment.