Skip to content

Commit 5c72269

Browse files
authored
Merge pull request #29 from autofac/feature/autofac-8
Update to Autofac 8.
2 parents 05de15e + 5bac5d0 commit 5c72269

18 files changed

+91
-148
lines changed

.editorconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ csharp_indent_switch_labels = true
3434
csharp_indent_labels = one_less_than_current
3535

3636
; Modifier preferences
37-
csharp_preferred_modifier_order = public,private,protected,internal,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,volatile,async:suggestion
37+
csharp_preferred_modifier_order = public,private,protected,internal,file,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,required,volatile,async:warning
3838

3939
; Avoid this. unless absolutely necessary
4040
dotnet_style_qualification_for_field = false:suggestion

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,6 @@ publish/
114114
*.pubxml
115115

116116
# NuGet Packages Directory
117-
## TODO: If you have NuGet Package Restore enabled, uncomment the next line
118117
packages/
119118

120119
# Windows Azure Build Output

.vscode/extensions.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
{
22
"recommendations": [
3-
"formulahendry.dotnet-test-explorer",
4-
"ms-dotnettools.csharp",
3+
"ms-dotnettools.csdevkit",
54
"editorconfig.editorconfig",
65
"davidanson.vscode-markdownlint"
76
]

.vscode/settings.json

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,15 @@
55
"cref",
66
"inheritdoc",
77
"langword",
8+
"netstandard",
89
"paramref",
910
"resx",
1011
"typeparam",
1112
"typeparamref",
1213
"xunit"
1314
],
14-
"dotnet-test-explorer.testProjectPath": "test/**/*Test.csproj",
1515
"explorer.fileNesting.patterns": {
16-
"*.resx": "$(capture).*.resx, $(capture).Designer.cs"
16+
"*.resx": "$(capture).*.resx, $(capture).designer.cs, $(capture).designer.vb"
1717
},
18-
"omnisharp.enableEditorConfigSupport": true,
19-
"omnisharp.enableRoslynAnalyzers": true
18+
"omnisharp.enableEditorConfigSupport": true
2019
}

appveyor.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
image: Ubuntu
22

3-
version: 6.1.0.{build}
3+
version: 7.0.0.{build}
44

55
dotnet_csproj:
6-
version_prefix: "6.1.0"
6+
version_prefix: "7.0.0"
77
patch: true
88
file: 'src\**\*.csproj'
99

build.ps1

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,19 @@ try {
5656

5757
if ($env:CI -eq "true") {
5858
# Generate Coverage Report
59+
Write-Message "Downloading and verifying Codecov Uploader"
60+
$ProgressPreference = 'SilentlyContinue'
61+
Invoke-WebRequest -Uri https://keybase.io/codecovsecurity/pgp_keys.asc -OutFile codecov.asc
62+
gpg --no-default-keyring --keyring trustedkeys.gpg --import codecov.asc
63+
Invoke-WebRequest -Uri https://uploader.codecov.io/latest/linux/codecov -Outfile codecov
64+
Invoke-WebRequest -Uri https://uploader.codecov.io/latest/linux/codecov.SHA256SUM -Outfile codecov.SHA256SUM
65+
Invoke-WebRequest -Uri https://uploader.codecov.io/latest/linux/codecov.SHA256SUM.sig -Outfile codecov.SHA256SUM.sig
66+
gpgv codecov.SHA256SUM.sig codecov.SHA256SUM
67+
shasum -a 256 -c codecov.SHA256SUM
68+
chmod +x codecov
69+
5970
Write-Message "Generating Codecov Report"
60-
Invoke-WebRequest -Uri 'https://codecov.io/bash' -OutFile codecov.sh
61-
& bash codecov.sh -f "artifacts/coverage/*/coverage*.info"
71+
& ./codecov -f "artifacts/coverage/*/coverage*.info"
6272
}
6373

6474
# Finished

build/Analyzers.ruleset

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,16 @@
44
<Rules AnalyzerId="Microsoft.Usage" RuleNamespace="Microsoft.Usage">
55
<!-- Implement standard exception constructors - not all of the exception constructors (e.g., parameterless) are desired in our system. -->
66
<Rule Id="CA1032" Action="None" />
7+
<!-- Use ArgumentNullException.ThrowIfNull - this isn't available until we stop targeting netstandard. -->
8+
<Rule Id="CA1510" Action="None" />
9+
<!-- Use ArgumentOutOfRangeException.ThrowIfNegative - this isn't available until we stop targeting anything below net8.0. -->
10+
<Rule Id="CA1512" Action="None" />
11+
<!-- Use ObjectDisposedException.ThrowIf - this isn't available until we stop targeting anything below net8.0. -->
12+
<Rule Id="CA1513" Action="None" />
713
<!-- Change names to avoid reserved word overlaps (e.g., Delegate, GetType, etc.) - too many of these in the public API, we'd break if we fixed it. -->
814
<Rule Id="CA1716" Action="None" />
15+
<!-- Cache a CompositeFormat object for use in String.Format - this isn't available until we stop targeting netstandard, and we only String.Format when throwing exceptions so the work/complexity isn't justified to increase perf just for those situations. -->
16+
<Rule Id="CA1863" Action="None" />
917
<!-- Implement serialization constructors - false positive when building .NET Core -->
1018
<Rule Id="CA2229" Action="None" />
1119
<!-- Mark ISerializable types with SerializableAttribute - false positive when building .NET Core -->
@@ -28,6 +36,8 @@
2836
<Rule Id="SA1203" Action="None" />
2937
<!-- Enforce order of static vs. non-static members -->
3038
<Rule Id="SA1204" Action="None" />
39+
<!-- Modifiers are not ordered - .editorconfig handles this -->
40+
<Rule Id="SA1206" Action="None" />
3141
<!-- Enforce order of readonly vs. non-readonly members -->
3242
<Rule Id="SA1214" Action="None" />
3343
<!-- Fields can't start with underscore -->

build/Test.ruleset

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
<Rule Id="CA1816" Action="None" />
1313
<!-- Mark members static - test methods may not access member data but also can't be static. -->
1414
<Rule Id="CA1822" Action="None" />
15+
<!-- Seal internal types - performance isn't an issue in test libraries. -->
16+
<Rule Id="CA1852" Action="None" />
1517
<!-- Do not directly await a task - this is for libraries rather than test code. -->
1618
<Rule Id="CA2007" Action="None" />
1719
<!-- Implement serialization constructors - false positive when building .NET Core. -->
@@ -38,6 +40,8 @@
3840
<Rule Id="SA1203" Action="None" />
3941
<!-- Enforce order of static vs. non-static members -->
4042
<Rule Id="SA1204" Action="None" />
43+
<!-- Modifiers are not ordered - .editorconfig handles this -->
44+
<Rule Id="SA1206" Action="None" />
4145
<!-- Enforce order of readonly vs. non-readonly members -->
4246
<Rule Id="SA1214" Action="None" />
4347
<!-- Fields can't start with underscore -->

global.json

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
{
22
"sdk": {
3-
"version": "6.0.300",
3+
"version": "8.0.201",
44
"rollForward": "latestFeature"
5-
}
5+
},
6+
7+
"additionalSdks": [
8+
"6.0.419",
9+
"7.0.406"
10+
]
611
}

src/Autofac.Integration.Mef/Autofac.Integration.Mef.csproj

Lines changed: 22 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,12 @@
1515
<SignAssembly>true</SignAssembly>
1616
<NeutralLanguage>en-US</NeutralLanguage>
1717
<!-- Frameworks and language features -->
18-
<TargetFrameworks>netstandard2.0</TargetFrameworks>
18+
<TargetFrameworks>net8.0;net7.0;net6.0;netstandard2.0</TargetFrameworks>
1919
<LangVersion>latest</LangVersion>
2020
<Nullable>enable</Nullable>
2121
<GenerateDocumentationFile>true</GenerateDocumentationFile>
2222
<CodeAnalysisRuleSet>../../build/Analyzers.ruleset</CodeAnalysisRuleSet>
23+
<EnforceCodeStyleInBuild>true</EnforceCodeStyleInBuild>
2324
<AnalysisMode>AllEnabledByDefault</AnalysisMode>
2425
<ImplicitUsings>enable</ImplicitUsings>
2526
<!-- Packaging -->
@@ -37,12 +38,19 @@
3738
<EmbedAllSources>true</EmbedAllSources>
3839
<IncludeSymbols>true</IncludeSymbols>
3940
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
41+
<!-- OmniSharp/VS Code resource generation -->
42+
<CoreCompileDependsOn>PrepareResources;$(CompileDependsOn)</CoreCompileDependsOn>
4043
</PropertyGroup>
4144

4245
<ItemGroup>
4346
<Using Include="System.Diagnostics.CodeAnalysis" />
4447
</ItemGroup>
4548

49+
<!-- Disable nullability warnings in netstandard2.0 -->
50+
<PropertyGroup Condition="'$(TargetFramework)' == 'netstandard2.0'">
51+
<NoWarn>$(NoWarn);8600;8601;8602;8603;8604</NoWarn>
52+
</PropertyGroup>
53+
4654
<ItemGroup>
4755
<None Include="..\..\build\icon.png" Pack="true" PackagePath="\" />
4856
<None Include="..\..\README.md" Pack="true" PackagePath="\" />
@@ -53,64 +61,40 @@
5361
</ItemGroup>
5462

5563
<ItemGroup>
56-
<PackageReference Include="Autofac" Version="6.4.0" />
57-
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1" Condition="Exists('$(MSBuildThisFileDirectory)../../.git')">
64+
<PackageReference Include="Autofac" Version="8.0.0" />
65+
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="8.0.0" Condition="Exists('$(MSBuildThisFileDirectory)../../.git')">
5866
<PrivateAssets>all</PrivateAssets>
5967
</PackageReference>
60-
<PackageReference Include="StyleCop.Analyzers" Version="1.2.0-beta.406">
68+
<PackageReference Include="StyleCop.Analyzers" Version="1.2.0-beta.556">
6169
<PrivateAssets>all</PrivateAssets>
6270
</PackageReference>
63-
<PackageReference Include="System.ComponentModel.Composition" Version="4.5.0" />
71+
<PackageReference Include="System.ComponentModel.Composition" Version="8.0.0" />
6472
</ItemGroup>
6573

66-
<ItemGroup>
67-
<!--
68-
Magic embedded resource incantation based on https://github.com/dotnet/msbuild/issues/4751
74+
<ItemDefinitionGroup>
75+
<EmbeddedResource>
76+
<Generator>MSBuild:Compile</Generator>
77+
<StronglyTypedLanguage>CSharp</StronglyTypedLanguage>
78+
<StronglyTypedFileName>$(IntermediateOutputPath)%(Filename).Designer.cs</StronglyTypedFileName>
79+
<StronglyTypedClassName>%(Filename)</StronglyTypedClassName>
80+
</EmbeddedResource>
81+
</ItemDefinitionGroup>
6982

70-
The EmbeddedResource entry seems to add the Designer files to Compile, so
71-
if you don't first remove them from Compile you get warnings about
72-
double-including source.
73-
-->
74-
<Compile Remove="**/*.Designer.cs" />
83+
<ItemGroup>
7584
<EmbeddedResource Update="ContractBasedServiceResources.resx">
76-
<Generator>ResXFileCodeGenerator</Generator>
77-
<LastGenOutput>ContractBasedServiceResources.Designer.cs</LastGenOutput>
78-
<StronglyTypedFileName>ContractBasedServiceResources.Designer.cs</StronglyTypedFileName>
79-
<StronglyTypedLanguage>CSharp</StronglyTypedLanguage>
8085
<StronglyTypedNamespace>Autofac.Integration.Mef</StronglyTypedNamespace>
81-
<StronglyTypedClassName>ContractBasedServiceResources</StronglyTypedClassName>
8286
</EmbeddedResource>
8387
<EmbeddedResource Update="LazyWithMetadataRegistrationSourceResources.resx">
84-
<Generator>ResXFileCodeGenerator</Generator>
85-
<LastGenOutput>LazyWithMetadataRegistrationSourceResources.Designer.cs</LastGenOutput>
86-
<StronglyTypedFileName>LazyWithMetadataRegistrationSourceResources.Designer.cs</StronglyTypedFileName>
87-
<StronglyTypedLanguage>CSharp</StronglyTypedLanguage>
8888
<StronglyTypedNamespace>Autofac.Integration.Mef</StronglyTypedNamespace>
89-
<StronglyTypedClassName>LazyWithMetadataRegistrationSourceResources</StronglyTypedClassName>
9089
</EmbeddedResource>
9190
<EmbeddedResource Update="StronglyTypedMetadataRegistrationSourceResources.resx">
92-
<Generator>ResXFileCodeGenerator</Generator>
93-
<LastGenOutput>StronglyTypedMetadataRegistrationSourceResources.Designer.cs</LastGenOutput>
94-
<StronglyTypedFileName>StronglyTypedMetadataRegistrationSourceResources.Designer.cs</StronglyTypedFileName>
95-
<StronglyTypedLanguage>CSharp</StronglyTypedLanguage>
9691
<StronglyTypedNamespace>Autofac.Integration.Mef</StronglyTypedNamespace>
97-
<StronglyTypedClassName>StronglyTypedMetadataRegistrationSourceResources</StronglyTypedClassName>
9892
</EmbeddedResource>
9993
<EmbeddedResource Update="RegistrationExtensionsResources.resx">
100-
<Generator>ResXFileCodeGenerator</Generator>
101-
<LastGenOutput>RegistrationExtensionsResources.Designer.cs</LastGenOutput>
102-
<StronglyTypedFileName>RegistrationExtensionsResources.Designer.cs</StronglyTypedFileName>
103-
<StronglyTypedLanguage>CSharp</StronglyTypedLanguage>
10494
<StronglyTypedNamespace>Autofac.Integration.Mef</StronglyTypedNamespace>
105-
<StronglyTypedClassName>RegistrationExtensionsResources</StronglyTypedClassName>
10695
</EmbeddedResource>
10796
<EmbeddedResource Update="Util\ReflectionExtensionsResources.resx">
108-
<Generator>ResXFileCodeGenerator</Generator>
109-
<LastGenOutput>ReflectionExtensionsResources.Designer.cs</LastGenOutput>
110-
<StronglyTypedFileName>Util\ReflectionExtensionsResources.Designer.cs</StronglyTypedFileName>
111-
<StronglyTypedLanguage>CSharp</StronglyTypedLanguage>
11297
<StronglyTypedNamespace>Autofac.Integration.Mef.Util</StronglyTypedNamespace>
113-
<StronglyTypedClassName>ReflectionExtensionsResources</StronglyTypedClassName>
11498
</EmbeddedResource>
11599
</ItemGroup>
116100

0 commit comments

Comments
 (0)