Skip to content

Commit acd3f5b

Browse files
committed
chore: code cleanup, project update, include readme, etc.
1 parent 7841a4f commit acd3f5b

18 files changed

Lines changed: 1389 additions & 1195 deletions

.editorconfig

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# top-most EditorConfig file
2+
root = true
3+
4+
# charset
5+
[*]
6+
charset = utf-8
7+
8+
# lines
9+
[*]
10+
end_of_line = lf
11+
insert_final_newline = true
12+
trim_trailing_whitespace = true
13+
max_line_length = off
14+
15+
# tabs
16+
[*]
17+
indent_style = space
18+
indent_size = 4
19+
tab_width = 4
20+
21+
[*.{csproj,props,resx,targets}]
22+
indent_style = space
23+
indent_size = 2
24+
tab_width = 2
25+
26+
# rules
27+
# CA2225: Operator overloads have named alternates
28+
dotnet_diagnostic.CA2225.severity = none
29+
# CA1716: Identifiers should not match keywords
30+
dotnet_diagnostic.CA1716.severity = none
31+
# CA1054: URI-like parameters should not be strings
32+
dotnet_diagnostic.CA1054.severity = none
33+
# CA1056: URI-like properties should not be strings
34+
dotnet_diagnostic.CA1056.severity = none
35+
# CA1062: Validate arguments of public methods
36+
dotnet_diagnostic.CA1062.severity = none
37+
# CA1033: Interface methods should be callable by child types
38+
dotnet_diagnostic.CA1033.severity = none
39+
# CA1034: Nested types should not be visible
40+
dotnet_diagnostic.CA1034.severity = none
41+
# CA1308: Normalize strings to uppercase
42+
dotnet_diagnostic.CA1308.severity = none
43+
# CA1805: Do not initialize unnecessarily
44+
dotnet_diagnostic.CA1805.severity = none
45+
# CA1031: Do not catch general exception types
46+
dotnet_diagnostic.CA1031.severity = none
47+
# CA1714: Flags enums should have plural names
48+
dotnet_diagnostic.CA1714.severity = none

Directory.Build.props

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
1-
<Project>
1+
<Project>
22

33
<!-- Company/Copyright -->
44
<PropertyGroup>
55
<Company>Tag Bites sp. z o.o.</Company>
66
<Authors>Tag Bites sp. z o.o.</Authors>
7-
<Copyright>Tag Bites sp. z o.o. © 2012-2021</Copyright>
7+
<CopyrightSinceYear>2012</CopyrightSinceYear>
8+
9+
<Copyright>© $(CopyrightSinceYear)-$([System.DateTime]::Today.ToString(`yyyy`)) $(Company)</Copyright>
810
</PropertyGroup>
911

1012
<!-- Bin/Obj directories -->
@@ -21,6 +23,11 @@
2123
<Deterministic>true</Deterministic>
2224
</PropertyGroup>
2325

26+
<!-- Documentation -->
27+
<PropertyGroup>
28+
<GenerateDocumentationFile>true</GenerateDocumentationFile>
29+
</PropertyGroup>
30+
2431
<!-- Warnings -->
2532
<PropertyGroup>
2633
<NoWarn>1701;1702;1591;NU5048;NU5125</NoWarn>
@@ -36,9 +43,20 @@
3643
<DefaultItemExcludes>$(DefaultItemExcludes);*.csproj.DotSettings</DefaultItemExcludes>
3744
</PropertyGroup>
3845

46+
<!-- Usings -->
47+
<ItemGroup>
48+
<Using Include="System" />
49+
<Using Include="System.Collections" />
50+
<Using Include="System.Collections.Generic" />
51+
<Using Include="System.IO" />
52+
<Using Include="System.Linq" />
53+
<Using Include="System.Threading" />
54+
<Using Include="System.Threading.Tasks" />
55+
<Using Include="JetBrains.Annotations" />
56+
</ItemGroup>
57+
3958
<!-- Includes -->
4059
<Import Condition="exists('Version.props')" Project="Version.props" />
41-
<Import Condition="exists('Licensing.props')" Project="Licensing.props" />
4260
<Import Condition="exists('Package.props')" Project="Package.props" />
4361

4462
</Project>

Directory.Build.targets

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,21 @@
11
<Project>
22

33
<ItemGroup>
4-
<PackageReference Include="GitInfo" Version="2.1.2">
5-
<PrivateAssets>All</PrivateAssets>
6-
</PackageReference>
74
<PackageReference Include="MinVer" Version="2.5.0">
85
<PrivateAssets>All</PrivateAssets>
96
</PackageReference>
107
</ItemGroup>
118

129
<!-- Copy package to local packages repository -->
13-
<Target Name="CopyPackage" AfterTargets="Pack" Condition="exists('$(SolutionDir)..\LocalPackages\')">
14-
<Message Text="Copy '$(PackageOutputPath)$(PackageId).$(PackageVersion).nupkg' to '$(SolutionDir)..\LocalPackages\'" Importance="high"/>
15-
<Copy
10+
<Target Name="CopyPackage" AfterTargets="Pack" Condition="exists('$(MSBuildThisFileDirectory)..\LocalPackages\')">
11+
<Message Text="Copy '$(PackageOutputPath)$(PackageId).$(PackageVersion).nupkg' to '$(MSBuildThisFileDirectory)..\LocalPackages\'" Importance="high"/>
12+
<Copy
1613
SourceFiles="$(PackageOutputPath)$(PackageId).$(PackageVersion).nupkg"
17-
DestinationFolder="$(SolutionDir)..\LocalPackages\"
18-
ContinueOnError="false" />
19-
20-
<Message Text="Delete local package folder 'C:\Users\User\.nuget\packages\$(PackageId)\$(PackageVersion)'" Importance="high"/>
21-
<RemoveDir Directories="C:\Users\User\.nuget\packages\$(PackageId)\$(PackageVersion)" />
14+
DestinationFolder="$(MSBuildThisFileDirectory)..\LocalPackages\"
15+
ContinueOnError="false" />
16+
17+
<Message Text="Delete local package folder 'C:\Users\$([System.Environment]::UserName)\.nuget\packages\$(PackageId)\$(PackageVersion)'" Importance="high"/>
18+
<RemoveDir Directories="C:\Users\$([System.Environment]::UserName)\.nuget\packages\$(PackageId)\$(PackageVersion)" />
2219
</Target>
2320

2421
</Project>

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2023 Tag Bites
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

Package.props

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,17 @@
11
<Project>
22
<PropertyGroup>
3-
<Description>Container and manager to simplify exports lookup.</Description>
4-
<PackageTags></PackageTags>
3+
<Description>A .NET export container and manager designed to simplify access to exported types. Well suited for plugin integration.</Description>
4+
<PackageTags>.NET; export; container; MEF</PackageTags>
55

6-
<PackageProjectUrl>https://www.tagbites.com/</PackageProjectUrl>
6+
<PackageProjectUrl>https://github.com/TagBites/TagBites.ComponentModel.Composition</PackageProjectUrl>
77
<PackageIconUrl></PackageIconUrl>
88

9+
<PackageRequireLicenseAcceptance>false</PackageRequireLicenseAcceptance>
10+
<PackageLicenseExpression>MIT</PackageLicenseExpression>
11+
912
<RepositoryType>git</RepositoryType>
1013
<RepositoryUrl>https://github.com/TagBites/TagBites.ComponentModel.Composition.git</RepositoryUrl>
14+
15+
<PackageReadmeFile>README.md</PackageReadmeFile>
1116
</PropertyGroup>
1217
</Project>

README.md

Lines changed: 42 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,44 @@
11
# TBS.ComponentModel.Composition
22

3-
Contains export container and manager to simplify exports lookup. It also supports cache to speedup app startup without need to load and analyse all assemblies.
3+
[![Nuget](https://img.shields.io/nuget/v/TagBites.ComponentModel.Composition.svg)](https://www.nuget.org/packages/TagBites.ComponentModel.Composition/)
4+
[![License](http://img.shields.io/github/license/TagBites/TagBites.ComponentModel.Composition)](https://github.com/TagBites/TagBites.ComponentModel.Composition/blob/master/LICENSE)
5+
6+
A .NET export container and manager designed to simplify access to exported types. Well suited for plugin integration. Supports caching to speed up application startup, eliminating the necessity to load and analyze all assemblies.
7+
8+
## Example
9+
10+
```csharp
11+
internal static class Program
12+
{
13+
public static ExportComponentManager ComponentManager { get; set; }
14+
15+
16+
static void Main()
17+
{
18+
// Load
19+
ComponentManager = new ExportComponentManager();
20+
21+
foreach (var assembly in AppDomain.CurrentDomain.GetAssemblies())
22+
ComponentManager.LoadAssembly(assembly);
23+
24+
// Test
25+
foreach (var testInstance in ComponentManager.GetExportInstances<ITest>())
26+
Console.WriteLine(testInstance.GetType().Name);
27+
28+
// Output:
29+
// Test1
30+
// Test2
31+
}
32+
}
33+
34+
public interface ITest
35+
{ }
36+
37+
[Export(typeof(ITest))]
38+
internal class Test1 : ITest
39+
{ }
40+
41+
[Export(typeof(ITest))]
42+
internal class Test2 : ITest
43+
{ }
44+
```

TagBites.ComponentModel.Composition.sln

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
11

22
Microsoft Visual Studio Solution File, Format Version 12.00
3-
# Visual Studio Version 16
4-
VisualStudioVersion = 16.0.29326.143
3+
# Visual Studio Version 17
4+
VisualStudioVersion = 17.8.34309.116
55
MinimumVisualStudioVersion = 10.0.40219.1
66
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TagBites.ComponentModel.Composition", "src\TagBites.ComponentModel.Composition\TagBites.ComponentModel.Composition.csproj", "{A7C9CFB8-03D0-45B4-9091-AA3AC35C6DFE}"
77
EndProject
88
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{2DDA76A3-970A-4E85-812E-B88BAF37418E}"
99
ProjectSection(SolutionItems) = preProject
1010
Directory.Build.props = Directory.Build.props
1111
Directory.Build.targets = Directory.Build.targets
12-
Licensing.props = Licensing.props
1312
Package.props = Package.props
1413
README.md = README.md
1514
Version.props = Version.props

src/Directory.Build.props

Lines changed: 0 additions & 3 deletions
This file was deleted.

0 commit comments

Comments
 (0)