Skip to content

Commit

Permalink
Merge pull request #27 from autofac/feature/net6-build
Browse files Browse the repository at this point in the history
Update build for .NET 6
  • Loading branch information
tillig authored Sep 30, 2022
2 parents cee9d74 + 11f768b commit 05de15e
Show file tree
Hide file tree
Showing 46 changed files with 2,237 additions and 2,358 deletions.
9 changes: 5 additions & 4 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -48,31 +48,31 @@ 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.severity = warning
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 be _camelCase
dotnet_naming_rule.static_fields_should_be_camel_case.severity = suggestion
dotnet_naming_rule.static_fields_should_be_camel_case.severity = warning
dotnet_naming_rule.static_fields_should_be_camel_case.symbols = static_fields
dotnet_naming_rule.static_fields_should_be_camel_case.style = camel_case_underscore_style
dotnet_naming_symbols.static_fields.applicable_kinds = field
dotnet_naming_symbols.static_fields.required_modifiers = static
dotnet_naming_symbols.static_fields.applicable_accessibilities = private, internal, private_protected

; Static readonly fields should be PascalCase
dotnet_naming_rule.static_readonly_fields_should_be_pascal_case.severity = suggestion
dotnet_naming_rule.static_readonly_fields_should_be_pascal_case.severity = warning
dotnet_naming_rule.static_readonly_fields_should_be_pascal_case.symbols = static_readonly_fields
dotnet_naming_rule.static_readonly_fields_should_be_pascal_case.style = pascal_case_style
dotnet_naming_symbols.static_readonly_fields.applicable_kinds = field
dotnet_naming_symbols.static_readonly_fields.required_modifiers = static, readonly
dotnet_naming_symbols.static_readonly_fields.applicable_accessibilities = private, internal, private_protected

; 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.severity = warning
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
Expand Down Expand Up @@ -128,6 +128,7 @@ csharp_style_throw_expression = true:suggestion
csharp_style_conditional_delegate_call = true:suggestion

# Other features
csharp_style_namespace_declarations = file_scoped:suggestion
csharp_style_prefer_index_operator = false:none
csharp_style_prefer_range_operator = false:none
csharp_style_pattern_local_over_anonymous_function = false:none
Expand Down
11 changes: 11 additions & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Ignore revisions in git blame - set your git config to use the file by convention:
# git config --global blame.ignoreRevsFile .git-blame-ignore-revs
#
# Optional additional git config:
# Mark any lines that have had a commit skipped using --ignore-rev with a `?`
# git config --global blame.markIgnoredLines true
# Mark any lines that were added in a skipped commit and can not be attributed with a `*`
# git config --global blame.markUnblamableLines true

# Convert to file-scoped namespaces.
55e222d88b289465dec967979b7e481849306c21
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ node_modules/
bower_components/
wwwroot/
project.lock.json
*.Designer.cs

# RIA/Silverlight projects
Generated_Code/
Expand Down
20 changes: 16 additions & 4 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,20 @@
{
"cSpell.words": [
"autofac",
"browsable",
"cref",
"inheritdoc",
"langword",
"paramref",
"resx",
"typeparam",
"typeparamref",
"xunit"
],
"dotnet-test-explorer.testProjectPath": "test/**/*Test.csproj",
"explorer.fileNesting.patterns": {
"*.resx": "$(capture).*.resx, $(capture).Designer.cs"
},
"omnisharp.enableEditorConfigSupport": true,
"omnisharp.enableRoslynAnalyzers": true,
"cSpell.words": [
"Xunit"
]
"omnisharp.enableRoslynAnalyzers": true
}
19 changes: 19 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
{
"args": [
"build",
"${workspaceFolder}/Autofac.Mef.sln",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary"
],
Expand All @@ -17,6 +18,24 @@
},
"problemMatcher": "$msCompile",
"type": "shell"
},
{
"args": [
"test",
"${workspaceFolder}/Autofac.Mef.sln",
"/property:GenerateFullPaths=true",
"/consoleloggerparameters:NoSummary",
"--filter",
"FullyQualifiedName!~Benchmark"
],
"command": "dotnet",
"group": {
"isDefault": true,
"kind": "test"
},
"label": "test",
"problemMatcher": "$msCompile",
"type": "process"
}
],
"version": "2.0.0"
Expand Down
5 changes: 3 additions & 2 deletions NuGet.config
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<clear />
<clear/>
<add key="Autofac MyGet" value="https://www.myget.org/F/autofac/api/v2" />
<add key="NuGet v3" value="https://api.nuget.org/v3/index.json" />
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
</packageSources>
<disabledPackageSources>
<add key="Microsoft and .NET" value="true" />
<add key="Autofac MyGet" value="true" />
</disabledPackageSources>
</configuration>
32 changes: 28 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,30 @@
Autofac.Mef
===========
# Autofac.Mef

Managed Extensibility Framework (MEF) integration for Autofac IoC
Managed Extensibility Framework (MEF) integration for [Autofac](https://autofac.org).

[![Build status](https://ci.appveyor.com/api/projects/status/404h0j4gj3qyn09a?svg=true)](https://ci.appveyor.com/project/Autofac/autofac-bwvcu) [![Open in Visual Studio Code](https://open.vscode.dev/badges/open-in-vscode.svg)](https://open.vscode.dev/autofac/Autofac.Mef)
[![Build status](https://ci.appveyor.com/api/projects/status/404h0j4gj3qyn09a?svg=true)](https://ci.appveyor.com/project/Autofac/autofac-bwvcu)

Please file issues and pull requests for this package [in this repository](https://github.com/autofac/Autofac.Mef/issues) rather than in the Autofac core repo.

- [Documentation](https://autofac.readthedocs.io/en/latest/integration/mef.html)
- [NuGet](https://www.nuget.org/packages/Autofac.Mef)
- [Contributing](https://autofac.readthedocs.io/en/latest/contributors.html)
- [Open in Visual Studio Code](https://open.vscode.dev/autofac/Autofac.Mef)

## Quick Start

The Autofac/MEF integration allows MEF catalogs to be registered with the `ContainerBuilder` using the `RegisterComposablePartCatalog()` extension method. If you register a component using MEF and want to provide Autofac components into that MEF component, use the `Exported()` extension.

```c#
var builder = new ContainerBuilder();
var catalog = new DirectoryCatalog(@"C:\MyExtensions");
builder.RegisterComposablePartCatalog(catalog);
builder.RegisterType<Component>()
.Exported(x => x.As<IService>().WithMetadata("SomeData", 42));
```

Check out the [Autofac MEF integration documentation](https://autofac.readthedocs.io/en/latest/integration/mef.html) for more information.

## Get Help

**Need help with Autofac?** We have [a documentation site](https://autofac.readthedocs.io/) as well as [API documentation](https://autofac.org/apidoc/). We're ready to answer your questions on [Stack Overflow](https://stackoverflow.com/questions/tagged/autofac) or check out the [discussion forum](https://groups.google.com/forum/#forum/autofac).
24 changes: 12 additions & 12 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
image: Ubuntu

version: 6.0.1.{build}
version: 6.1.0.{build}

dotnet_csproj:
version_prefix: '6.0.1'
version_prefix: "6.1.0"
patch: true
file: 'src\**\*.csproj'

Expand All @@ -20,20 +20,20 @@ nuget:

clone_depth: 1

test: off
test: false

build_script:
- pwsh: .\build.ps1

artifacts:
- path: artifacts\packages\**\*.nupkg
name: MyGet
- path: artifacts\packages\**\*.*nupkg
name: MyGet
type: NuGetPackage

deploy:
- provider: NuGet
server: https://www.myget.org/F/autofac/api/v2/package
api_key:
secure: xUXExgVAagrdEicCjSxsQVrwiLo2TtnfqMbYB9Cauq2cpbm/EVz957PBK0v/GEYq
skip_symbols: true
symbol_server: https://www.myget.org/F/autofac/symbols/api/v2/package
artifact: MyGet
- provider: NuGet
server: https://www.myget.org/F/autofac/api/v2/package
symbol_server: https://www.myget.org/F/autofac/api/v2/package
api_key:
secure: xUXExgVAagrdEicCjSxsQVrwiLo2TtnfqMbYB9Cauq2cpbm/EVz957PBK0v/GEYq
artifact: MyGet
17 changes: 11 additions & 6 deletions build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,17 @@ try {
Remove-Item $artifactsPath -Force -Recurse
}

# Install dotnet CLI
Install-DotNetCli -Version $sdkVersion

foreach ($additional in $globalJson.additionalSdks)
{
Install-DotNetCli -Version $additional;
# Install dotnet SDK versions during CI. In a local build we assume you have
# everything installed; on CI we'll force the install. If you install _any_
# SDKs, you have to install _all_ of them because you can't install SDKs in
# two different locations. dotnet CLI locates SDKs relative to the
# executable.
if ($Null -ne $env:APPVEYOR_BUILD_NUMBER) {
Install-DotNetCli -Version $sdkVersion
foreach ($additional in $globalJson.additionalSdks)
{
Install-DotNetCli -Version $additional;
}
}

# Write out dotnet information
Expand Down
4 changes: 1 addition & 3 deletions build/Analyzers.ruleset
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,7 @@
<Rule Id="SA1309" Action="None" />
<!-- Suppressions must have a justification -->
<Rule Id="SA1404" Action="None" />
<!-- Use trailing comma in initializers - lots of false positives for enums in StyleCop 1.1.0-beta004 -->
<Rule Id="SA1413" Action="None" />
<!-- Parameter documentation mus be in the right order -->
<!-- Parameter documentation must be in the right order -->
<Rule Id="SA1612" Action="None" />
<!-- Return value must be documented -->
<Rule Id="SA1615" Action="None" />
Expand Down
45 changes: 13 additions & 32 deletions build/Autofac.Build.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
# 4: dotnet / NuGet package restore failure

<#
.SYNOPSIS
Gets the set of directories in which projects are available for compile/processing.
.SYNOPSIS
Gets the set of directories in which projects are available for compile/processing.
.PARAMETER RootPath
Path where searching for project directories should begin.
.PARAMETER RootPath
Path where searching for project directories should begin.
#>
function Get-DotNetProjectDirectory {
[CmdletBinding()]
Expand All @@ -34,25 +34,6 @@ function Install-DotNetCli {
[string]
$Version = "Latest"
)

if ($null -ne (Get-Command "dotnet" -ErrorAction SilentlyContinue)) {
$installedVersions = dotnet --list-sdks
foreach ($sdkListLine in $installedVersions)
{
$splitParts = $sdkListLine.Split(" ");

$versionPart = $splitParts[0];
$globalInstallLocation = $splitParts[1].Replace("[", "").Replace("]", "")

if ($versionPart -eq $Version)
{
Write-Message ".NET Core SDK version $Version is already installed in $globalInstallLocation"
Add-Path "$globalInstallLocation"
return;
}
}
}

Write-Message "Installing .NET SDK version $Version"

$callerPath = Split-Path $MyInvocation.PSCommandPath
Expand Down Expand Up @@ -103,7 +84,7 @@ function Add-Path {
if ($pathValues -Contains $Path) {
return;
}

$env:PATH = "${Path}${pathSeparator}$env:PATH"
}

Expand Down Expand Up @@ -134,17 +115,17 @@ function Invoke-DotNetBuild {
}

<#
.SYNOPSIS
Invokes the dotnet utility to package a project.
.SYNOPSIS
Invokes the dotnet utility to package a project.
.PARAMETER ProjectDirectory
Path to the directory containing the project to package.
.PARAMETER ProjectDirectory
Path to the directory containing the project to package.
.PARAMETER PackagesPath
Path to the "artifacts/packages" folder where packages should go.
.PARAMETER PackagesPath
Path to the "artifacts/packages" folder where packages should go.
.PARAMETER VersionSuffix
The version suffix to use for the NuGet package version.
.PARAMETER VersionSuffix
The version suffix to use for the NuGet package version.
#>
function Invoke-DotNetPack {
[CmdletBinding()]
Expand Down
70 changes: 70 additions & 0 deletions build/Test.ruleset
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
<?xml version="1.0" encoding="utf-8"?>
<RuleSet Name="Autofac Analyzer Rules" Description="Analyzer rules for Autofac assemblies." ToolsVersion="16.0">
<IncludeAll Action="Warning" />
<Rules AnalyzerId="Microsoft.Usage" RuleNamespace="Microsoft.Usage">
<!-- Implement standard exception constructors - not all of the exception constructors (e.g., parameterless) are desired in our system. -->
<Rule Id="CA1032" Action="None" />
<!-- Remove the underscores from member name - unit test scenarios may use underscores. -->
<Rule Id="CA1707" Action="None" />
<!-- 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. -->
<Rule Id="CA1716" Action="None" />
<!-- Change Dispose() to call GC.SuppressFinalize - in tests we don't really care and it can impact readability. -->
<Rule Id="CA1816" Action="None" />
<!-- Mark members static - test methods may not access member data but also can't be static. -->
<Rule Id="CA1822" Action="None" />
<!-- Do not directly await a task - this is for libraries rather than test code. -->
<Rule Id="CA2007" Action="None" />
<!-- Implement serialization constructors - false positive when building .NET Core. -->
<Rule Id="CA2229" Action="None" />
<!-- Use Uri instead of string parameters - strings are easier for testing. -->
<Rule Id="CA2234" Action="None" />
<!-- Mark ISerializable types with SerializableAttribute - false positive when building .NET Core. -->
<Rule Id="CA2237" Action="None" />
</Rules>
<Rules AnalyzerId="StyleCop.Analyzers" RuleNamespace="StyleCop.Analyzers">
<!-- Prefix local calls with this -->
<Rule Id="SA1101" Action="None" />
<!-- Use built-in type alias -->
<Rule Id="SA1121" Action="None" />
<!-- Use String.Empty instead of "" -->
<Rule Id="SA1122" Action="None" />
<!-- Using statements must be inside a namespace -->
<Rule Id="SA1200" Action="None" />
<!-- Enforce order of class members by member type -->
<Rule Id="SA1201" Action="None" />
<!-- Enforce order of class members by member visibility -->
<Rule Id="SA1202" Action="None" />
<!-- Enforce order of constantand static members -->
<Rule Id="SA1203" Action="None" />
<!-- Enforce order of static vs. non-static members -->
<Rule Id="SA1204" Action="None" />
<!-- Enforce order of readonly vs. non-readonly members -->
<Rule Id="SA1214" Action="None" />
<!-- Fields can't start with underscore -->
<Rule Id="SA1309" Action="None" />
<!-- Suppressions must have a justification -->
<Rule Id="SA1404" Action="None" />
<!-- Elements should be documented -->
<Rule Id="SA1600" Action="None" />
<!-- Enuemration items should be documented -->
<Rule Id="SA1602" Action="None" />
<!-- Parameter documentation must be in the right order -->
<Rule Id="SA1612" Action="None" />
<!-- Return value must be documented -->
<Rule Id="SA1615" Action="None" />
<!-- Generic type parameters must be documented -->
<Rule Id="SA1618" Action="None" />
<!-- Don't copy/paste documentation -->
<Rule Id="SA1625" Action="None" />
<!-- Exception documentation must not be empty -->
<Rule Id="SA1627" Action="None" />
<!-- Enable XML documentation output-->
<Rule Id="SA1652" Action="None" />
<!-- Private member is unused - tests for reflection require members that may not get used. -->
<Rule Id="IDE0051" Action="None" />
<!-- Private member assigned value never read - tests for reflection require values that may not get used. -->
<Rule Id="IDE0052" Action="None" />
<!-- Remove unused parameter - tests for reflection require parameters that may not get used. -->
<Rule Id="IDE0060" Action="None" />
</Rules>
</RuleSet>
Loading

0 comments on commit 05de15e

Please sign in to comment.