Skip to content

Commit 5e4935a

Browse files
committed
Fix csproj indent and start on assembly metadata
1 parent da77617 commit 5e4935a

19 files changed

+396
-131
lines changed

.editorconfig

+145
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,145 @@
1+
; EditorConfig to support per-solution formatting.
2+
; Use the EditorConfig VS add-in to make this work.
3+
; http://editorconfig.org/
4+
5+
; This is the default for the codeline.
6+
root = true
7+
8+
[*]
9+
; Don't use tabs for indentation.
10+
indent_style = space
11+
; (Please don't specify an indent_size here; that has too many unintended consequences.)
12+
charset = utf-8
13+
trim_trailing_whitespace = true
14+
insert_final_newline = true
15+
16+
# Spell checker configuration
17+
spelling_exclusion_path = spelling.dic
18+
19+
; Code files
20+
[*.{cs}]
21+
indent_size = 4
22+
23+
; All XML-based file formats
24+
[*.{config,csproj,nuspec,props,resx,ruleset,targets,vsct,vsixmanifest,xaml,xml,vsmanproj,swixproj}]
25+
indent_size = 2
26+
27+
; JSON files
28+
[*.json]
29+
indent_size = 2
30+
31+
; PowerShell scripts
32+
[*.{ps1}]
33+
indent_size = 4
34+
35+
[*.{sh}]
36+
indent_size = 4
37+
38+
; Dotnet code style settings
39+
[*.{cs,vb}]
40+
; Sort using and Import directives with System.* appearing first
41+
dotnet_sort_system_directives_first = true
42+
dotnet_separate_import_directive_groups = false
43+
44+
; IDE0003 Avoid "this." and "Me." if not necessary
45+
dotnet_style_qualification_for_field = false:warning
46+
dotnet_style_qualification_for_property = false:warning
47+
dotnet_style_qualification_for_method = false:warning
48+
dotnet_style_qualification_for_event = false:warning
49+
50+
; IDE0012 Use language keywords instead of framework type names for type references
51+
dotnet_style_predefined_type_for_locals_parameters_members = true:warning
52+
; IDE0013
53+
dotnet_style_predefined_type_for_member_access = true:warning
54+
55+
; Suggest more modern language features when available
56+
dotnet_style_object_initializer = true:suggestion
57+
dotnet_style_collection_initializer = true:suggestion
58+
dotnet_style_explicit_tuple_names = true:suggestion
59+
dotnet_style_coalesce_expression = true:suggestion
60+
dotnet_style_null_propagation = true:suggestion
61+
62+
; CSharp code style settings
63+
[*.cs]
64+
; IDE0007 'var' preferences
65+
csharp_style_var_for_built_in_types = true:none
66+
csharp_style_var_when_type_is_apparent = true:none
67+
csharp_style_var_elsewhere = false:none
68+
69+
; Prefer method-like constructs to have a block body
70+
csharp_style_expression_bodied_methods = false:none
71+
csharp_style_expression_bodied_constructors = false:none
72+
csharp_style_expression_bodied_operators = false:none
73+
74+
; Prefer property-like constructs to have an expression-body
75+
csharp_style_expression_bodied_properties = true:suggestion
76+
csharp_style_expression_bodied_indexers = true:suggestion
77+
csharp_style_expression_bodied_accessors = true:suggestion
78+
79+
; Suggest more modern language features when available
80+
csharp_style_pattern_matching_over_is_with_cast_check = true:none
81+
csharp_style_pattern_matching_over_as_with_null_check = true:none
82+
csharp_style_inlined_variable_declaration = true:none
83+
csharp_style_throw_expression = true:none
84+
csharp_style_conditional_delegate_call = true:suggestion
85+
86+
; Newline settings
87+
csharp_new_line_before_open_brace = all
88+
csharp_new_line_before_else = true
89+
csharp_new_line_before_catch = true
90+
csharp_new_line_before_finally = true
91+
csharp_new_line_before_members_in_object_initializers = true
92+
csharp_new_line_before_members_in_anonymous_types = true
93+
94+
; Naming styles
95+
dotnet_naming_style.pascal_case_style.capitalization = pascal_case
96+
dotnet_naming_style.camel_case_style.capitalization = camel_case
97+
98+
; Naming rule: async methods end in Async
99+
dotnet_naming_style.async_method_style.capitalization = pascal_case
100+
dotnet_naming_style.async_method_style.required_suffix = Async
101+
dotnet_naming_symbols.async_method_symbols.applicable_kinds = method
102+
dotnet_naming_symbols.async_method_symbols.required_modifiers = async
103+
dotnet_naming_rule.async_methods_rule.severity = suggestion
104+
dotnet_naming_rule.async_methods_rule.symbols = async_method_symbols
105+
dotnet_naming_rule.async_methods_rule.style = async_method_style
106+
107+
; Naming rule: Interfaces must be pascal-cased prefixed with I
108+
dotnet_naming_style.interface_style.capitalization = pascal_case
109+
dotnet_naming_style.interface_style.required_prefix = I
110+
dotnet_naming_symbols.interface_symbols.applicable_kinds = interface
111+
dotnet_naming_symbols.interface_symbols.applicable_accessibilities = *
112+
dotnet_naming_rule.interfaces_rule.severity = warning
113+
dotnet_naming_rule.interfaces_rule.symbols = interface_symbols
114+
dotnet_naming_rule.interfaces_rule.style = interface_style
115+
116+
; Naming rule: All methods and properties must be pascal-cased
117+
dotnet_naming_symbols.method_and_property_symbols.applicable_kinds = method,property,class,struct,enum:property,namespace
118+
dotnet_naming_symbols.method_and_property_symbols.applicable_accessibilities = *
119+
dotnet_naming_rule.methods_and_properties_rule.severity = warning
120+
dotnet_naming_rule.methods_and_properties_rule.symbols = method_and_property_symbols
121+
dotnet_naming_rule.methods_and_properties_rule.style = pascal_case_style
122+
123+
; Naming rule: Static fields must be pascal-cased
124+
dotnet_naming_symbols.static_member_symbols.applicable_kinds = field
125+
dotnet_naming_symbols.static_member_symbols.applicable_accessibilities = *
126+
dotnet_naming_symbols.static_member_symbols.required_modifiers = static
127+
dotnet_naming_symbols.const_member_symbols.applicable_kinds = field
128+
dotnet_naming_symbols.const_member_symbols.applicable_accessibilities = *
129+
dotnet_naming_symbols.const_member_symbols.required_modifiers = const
130+
dotnet_naming_rule.static_fields_rule.severity = warning
131+
dotnet_naming_rule.static_fields_rule.symbols = static_member_symbols
132+
dotnet_naming_rule.static_fields_rule.style = pascal_case_style
133+
134+
; Naming rule: Private members must be camel-cased and prefixed with underscore
135+
dotnet_naming_style.private_member_style.capitalization = camel_case
136+
dotnet_naming_style.private_member_style.required_prefix = _
137+
dotnet_naming_symbols.private_field_symbols.applicable_kinds = field,event
138+
dotnet_naming_symbols.private_field_symbols.applicable_accessibilities = private,protected,internal
139+
dotnet_naming_rule.private_field_rule.severity = warning
140+
dotnet_naming_rule.private_field_rule.symbols = private_field_symbols
141+
dotnet_naming_rule.private_field_rule.style = private_member_style
142+
143+
; Diagnostics rule: Don't leave unnecessary suppressions
144+
dotnet_diagnostic.IDE0076.severity = warning
145+
dotnet_diagnostic.IDE0005.severity = warning

Directory.Build.props

+15-15
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
<Project>
22

3-
<PropertyGroup>
4-
<MinVerTagPrefix>v</MinVerTagPrefix>
5-
</PropertyGroup>
3+
<PropertyGroup>
4+
<MinVerTagPrefix>v</MinVerTagPrefix>
5+
</PropertyGroup>
66

7-
<PropertyGroup>
8-
<Nullable>enable</Nullable>
9-
<ImplicitUsings>enable</ImplicitUsings>
10-
</PropertyGroup>
7+
<PropertyGroup>
8+
<Nullable>enable</Nullable>
9+
<ImplicitUsings>enable</ImplicitUsings>
10+
</PropertyGroup>
1111

12-
<ItemGroup>
13-
<AssemblyMetadata Include="BuildTimestamp" Condition="'$(Configuration)' == 'Debug'">
14-
<Value>$([System.DateTime]::Today.ToString("O"))</Value>
15-
</AssemblyMetadata>
16-
<AssemblyMetadata Include="BuildTimestamp" Condition="'$(Configuration)' != 'Debug'">
17-
<Value>$([System.DateTime]::UtcNow.ToString("O"))</Value>
18-
</AssemblyMetadata>
19-
</ItemGroup>
12+
<ItemGroup>
13+
<AssemblyMetadata Include="BuildTimestamp" Condition="'$(Configuration)' == 'Debug'">
14+
<Value>$([System.DateTime]::Today.ToString("O"))</Value>
15+
</AssemblyMetadata>
16+
<AssemblyMetadata Include="BuildTimestamp" Condition="'$(Configuration)' != 'Debug'">
17+
<Value>$([System.DateTime]::UtcNow.ToString("O"))</Value>
18+
</AssemblyMetadata>
19+
</ItemGroup>
2020

2121
</Project>

Directory.Packages.props

+26-25
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,28 @@
11
<Project>
2-
<PropertyGroup>
3-
<NuGetPackageVersion>6.8.0</NuGetPackageVersion>
4-
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
5-
<CentralPackageTransitivePinningEnabled>false</CentralPackageTransitivePinningEnabled>
6-
</PropertyGroup>
7-
<ItemGroup>
8-
<GlobalPackageReference Include="Microsoft.SourceLink.GitHub" Version="8.0.0" />
9-
<GlobalPackageReference Include="MinVer" Version="4.3.0" />
10-
</ItemGroup>
11-
<ItemGroup>
12-
<PackageVersion Include="AngleSharp" Version="1.0.7" />
13-
<PackageVersion Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.22.0" />
14-
<PackageVersion Include="Microsoft.AspNetCore.Mvc.Testing" Version="8.0.0" />
15-
<PackageVersion Include="Microsoft.Extensions.Logging.Abstractions" Version="8.0.0" />
16-
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
17-
<PackageVersion Include="Microsoft.Web.Xdt" Version="2.1.0" />
18-
<PackageVersion Include="Mono.Cecil" Version="0.11.5" />
19-
<PackageVersion Include="NuGet.Core" Version="2.14.0" />
20-
<PackageVersion Include="NuGet.Frameworks" Version="$(NuGetPackageVersion)" />
21-
<PackageVersion Include="NuGet.PackageManagement" Version="$(NuGetPackageVersion)" />
22-
<PackageVersion Include="NuGet.Versioning" Version="$(NuGetPackageVersion)" />
23-
<PackageVersion Include="System.CommandLine" Version="2.0.0-beta4.22272.1" />
24-
<PackageVersion Include="xunit" Version="2.6.3" />
25-
<PackageVersion Include="xunit.runner.visualstudio" Version="2.5.5" />
26-
</ItemGroup>
2+
<PropertyGroup>
3+
<NuGetPackageVersion>6.8.0</NuGetPackageVersion>
4+
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
5+
<CentralPackageTransitivePinningEnabled>false</CentralPackageTransitivePinningEnabled>
6+
</PropertyGroup>
7+
<ItemGroup>
8+
<GlobalPackageReference Include="Microsoft.SourceLink.GitHub" Version="8.0.0" />
9+
<GlobalPackageReference Include="MinVer" Version="4.3.0" />
10+
</ItemGroup>
11+
<ItemGroup>
12+
<PackageVersion Include="AngleSharp" Version="1.0.7" />
13+
<PackageVersion Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.22.0" />
14+
<PackageVersion Include="Microsoft.AspNetCore.Mvc.Testing" Version="8.0.0" />
15+
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp" Version="4.8.0" />
16+
<PackageVersion Include="Microsoft.Extensions.Logging.Abstractions" Version="8.0.0" />
17+
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
18+
<PackageVersion Include="Microsoft.Web.Xdt" Version="2.1.0" />
19+
<PackageVersion Include="Mono.Cecil" Version="0.11.5" />
20+
<PackageVersion Include="NuGet.Core" Version="2.14.0" />
21+
<PackageVersion Include="NuGet.Frameworks" Version="$(NuGetPackageVersion)" />
22+
<PackageVersion Include="NuGet.PackageManagement" Version="$(NuGetPackageVersion)" />
23+
<PackageVersion Include="NuGet.Versioning" Version="$(NuGetPackageVersion)" />
24+
<PackageVersion Include="System.CommandLine" Version="2.0.0-beta4.22272.1" />
25+
<PackageVersion Include="xunit" Version="2.6.3" />
26+
<PackageVersion Include="xunit.runner.visualstudio" Version="2.5.5" />
27+
</ItemGroup>
2728
</Project>

NuGet.Config

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
<?xml version="1.0" encoding="utf-8"?>
1+
<?xml version="1.0" encoding="utf-8"?>
22
<configuration>
33
<packageSources>
44
<clear />
55
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" />
66
</packageSources>
77
<disabledPackageSources>
8-
<clear />
8+
<clear />
99
</disabledPackageSources>
1010
</configuration>

NuGetTools.sln

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{C65B2136-124
77
EndProject
88
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{A4ECEBC3-81BD-4BE4-80E7-D4011B729DA2}"
99
ProjectSection(SolutionItems) = preProject
10+
.editorconfig = .editorconfig
1011
Directory.Build.props = Directory.Build.props
1112
Directory.Packages.props = Directory.Packages.props
1213
global.json = global.json

spelling.dic

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
knapcode
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

3-
<PropertyGroup>
4-
<TargetFramework>net8.0</TargetFramework>
5-
</PropertyGroup>
3+
<PropertyGroup>
4+
<TargetFramework>net8.0</TargetFramework>
5+
</PropertyGroup>
66

7-
<ItemGroup>
8-
<ProjectReference Include="..\Knapcode.NuGetTools.Logic.NuGet2x\Knapcode.NuGetTools.Logic.NuGet2x.csproj" />
9-
<ProjectReference Include="..\Knapcode.NuGetTools.Logic.NuGet3x\Knapcode.NuGetTools.Logic.NuGet3x.csproj" />
10-
</ItemGroup>
7+
<ItemGroup>
8+
<ProjectReference Include="..\Knapcode.NuGetTools.Logic.NuGet2x\Knapcode.NuGetTools.Logic.NuGet2x.csproj" />
9+
<ProjectReference Include="..\Knapcode.NuGetTools.Logic.NuGet3x\Knapcode.NuGetTools.Logic.NuGet3x.csproj" />
10+
</ItemGroup>
1111

12-
<ItemGroup>
13-
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" />
14-
<PackageReference Include="Mono.Cecil" />
15-
<PackageReference Include="NuGet.PackageManagement" />
16-
</ItemGroup>
12+
<ItemGroup>
13+
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" />
14+
<PackageReference Include="Mono.Cecil" />
15+
<PackageReference Include="NuGet.PackageManagement" />
16+
</ItemGroup>
1717

1818
</Project>
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

3-
<PropertyGroup>
4-
<TargetFramework>net8.0</TargetFramework>
5-
</PropertyGroup>
3+
<PropertyGroup>
4+
<TargetFramework>net8.0</TargetFramework>
5+
</PropertyGroup>
66

7-
<ItemGroup>
8-
<PackageReference Include="Microsoft.Web.Xdt" NoWarn="NU1701" />
9-
<PackageReference Include="NuGet.Core" NoWarn="NU1701" />
10-
</ItemGroup>
7+
<ItemGroup>
8+
<PackageReference Include="Microsoft.Web.Xdt" NoWarn="NU1701" />
9+
<PackageReference Include="NuGet.Core" NoWarn="NU1701" />
10+
</ItemGroup>
1111

12-
<ItemGroup>
13-
<ProjectReference Include="..\Knapcode.NuGetTools.Logic\Knapcode.NuGetTools.Logic.csproj" />
14-
</ItemGroup>
12+
<ItemGroup>
13+
<ProjectReference Include="..\Knapcode.NuGetTools.Logic\Knapcode.NuGetTools.Logic.csproj" />
14+
</ItemGroup>
1515

1616
</Project>

src/Knapcode.NuGetTools.Logic.NuGet2x/NuGetLogic2x.cs

+3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using Knapcode.NuGetTools.Logic.Wrappers;
2+
using NuGet;
23

34
namespace Knapcode.NuGetTools.Logic.NuGet2x;
45

@@ -9,9 +10,11 @@ public NuGetLogic2x()
910
Framework = new FrameworkLogic2x();
1011
Version = new VersionLogic2x();
1112
VersionRange = new VersionRangeLogic2x();
13+
Assemblies = new[] { NuGetAssembly.FromType<SemanticVersion>() };
1214
}
1315

1416
public IFrameworkLogic Framework { get; }
1517
public IVersionLogic Version { get; }
1618
public IVersionRangeLogic VersionRange { get; }
19+
public IReadOnlyList<NuGetAssembly> Assemblies { get; }
1720
}
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

3-
<PropertyGroup>
4-
<TargetFramework>net8.0</TargetFramework>
5-
</PropertyGroup>
3+
<PropertyGroup>
4+
<TargetFramework>net8.0</TargetFramework>
5+
</PropertyGroup>
66

7-
<ItemGroup>
8-
<PackageReference Include="NuGet.Frameworks" />
9-
<PackageReference Include="NuGet.Versioning" />
10-
</ItemGroup>
7+
<ItemGroup>
8+
<PackageReference Include="NuGet.Frameworks" />
9+
<PackageReference Include="NuGet.Versioning" />
10+
</ItemGroup>
1111

12-
<ItemGroup>
13-
<ProjectReference Include="..\Knapcode.NuGetTools.Logic\Knapcode.NuGetTools.Logic.csproj" />
14-
</ItemGroup>
12+
<ItemGroup>
13+
<ProjectReference Include="..\Knapcode.NuGetTools.Logic\Knapcode.NuGetTools.Logic.csproj" />
14+
</ItemGroup>
1515

1616
</Project>

src/Knapcode.NuGetTools.Logic.NuGet3x/NuGetLogic3x.cs

+8
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
using Knapcode.NuGetTools.Logic.Wrappers;
2+
using NuGet.Frameworks;
3+
using NuGet.Versioning;
24

35
namespace Knapcode.NuGetTools.Logic.NuGet3x;
46

@@ -9,9 +11,15 @@ public NuGetLogic3x()
911
Framework = new FrameworkLogic3x();
1012
Version = new VersionLogic3x();
1113
VersionRange = new VersionRangeLogic3x();
14+
Assemblies = new[]
15+
{
16+
NuGetAssembly.FromType<NuGetFramework>(),
17+
NuGetAssembly.FromType<NuGetVersion>(),
18+
};
1219
}
1320

1421
public IFrameworkLogic Framework { get; }
1522
public IVersionLogic Version { get; }
1623
public IVersionRangeLogic VersionRange { get; }
24+
public IReadOnlyList<NuGetAssembly> Assemblies { get; }
1725
}

src/Knapcode.NuGetTools.Logic/FrameworkEnumerationOptions.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
namespace Knapcode.NuGetTools.Logic;
1+
namespace Knapcode.NuGetTools.Logic;
22

33
[Flags]
44
public enum FrameworkEnumerationOptions

0 commit comments

Comments
 (0)