├── .github
├── dependabot.yml
└── workflows
│ ├── dotnetcore.yml
│ └── codeql-analysis.yml
├── README.md
├── DllValidator
├── DllValidator.csproj
├── FileProperties.cs
└── Program.cs
├── .gitignore
├── DllProps.Tool
├── DllProps.Tool.csproj
└── Program.cs
├── .nuget
└── .nuget.config
├── LICENSE
└── DllProps.sln
/.github/dependabot.yml:
--------------------------------------------------------------------------------
1 | version: 2
2 | updates:
3 | - package-ecosystem: nuget
4 | directory: "/"
5 | schedule:
6 | interval: monthly
7 | open-pull-requests-limit: 3
8 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # This project looking for a new owner
2 | ---
3 | # dll-props
4 | `dotnet` tool to get dll file properties.
5 |
6 | ## Installation and Use
7 |
8 | This tool is deployed as a [`dotnet tool`](https://docs.microsoft.com/en-us/dotnet/core/tools/global-tools). As such, the installation and use is very simple:
9 |
10 | ```
11 | dotnet tool install -g DllProps.Tool
12 | ```
13 |
--------------------------------------------------------------------------------
/DllValidator/DllValidator.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Exe
5 | net6.0;netcoreapp5;netcoreapp3.1;netcoreapp2.1
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | *.swp
2 | *.*~
3 | project.lock.json
4 | .DS_Store
5 | *.pyc
6 |
7 | # Visual Studio Code
8 | .vscode
9 |
10 | # User-specific files
11 | *.suo
12 | *.user
13 | *.userosscache
14 | *.sln.docstates
15 |
16 | # Build results
17 | [Dd]ebug/
18 | [Dd]ebugPublic/
19 | [Rr]elease/
20 | [Rr]eleases/
21 | x64/
22 | x86/
23 | build/
24 | bld/
25 | [Bb]in/
26 | [Oo]bj/
27 | msbuild.log
28 | msbuild.err
29 | msbuild.wrn
30 |
31 | # Visual Studio 2015
32 | .vs/
--------------------------------------------------------------------------------
/DllProps.Tool/DllProps.Tool.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Exe
5 | net6.0;netcoreapp5;netcoreapp3.1;netcoreapp2.1
6 |
7 | https://github.com/baruchiro/dll-props
8 | true
9 | dll-props
10 | ../
11 | 3.0.0
12 |
13 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/DllProps.Tool/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Diagnostics;
3 |
4 | namespace DllProps.Tool
5 | {
6 | class Program
7 | {
8 | static void Main(string[] args)
9 | {
10 | var info = FileVersionInfo.GetVersionInfo(args[0]);
11 | Console.WriteLine($"Company: {info.CompanyName}");
12 | Console.WriteLine($"Copyright: {info.LegalCopyright}");
13 | Console.WriteLine($"FileVersion: {info.FileVersion}");
14 | Console.WriteLine($"ProductVersion: {info.ProductVersion}");
15 | Console.WriteLine($"Description: {info.FileDescription}");
16 | }
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/.nuget/.nuget.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/DllValidator/FileProperties.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Diagnostics;
4 | using System.Text;
5 |
6 | namespace DllValidator
7 | {
8 | class FileProperties
9 | {
10 | private readonly FileVersionInfo fileVersionInfo;
11 | private readonly Type fileVersionInfoType = typeof(FileVersionInfo);
12 |
13 | public FileProperties(string filePath)
14 | {
15 | fileVersionInfo = FileVersionInfo.GetVersionInfo(filePath);
16 | }
17 |
18 | public string this[string prop] =>
19 | fileVersionInfoType.GetProperty(prop).GetValue(fileVersionInfo) as string;
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/.github/workflows/dotnetcore.yml:
--------------------------------------------------------------------------------
1 | name: .NET Core
2 |
3 | on:
4 | push:
5 | branches: master
6 |
7 | jobs:
8 | build:
9 |
10 | runs-on: ubuntu-latest
11 |
12 | steps:
13 | - uses: actions/checkout@v1
14 | - name: Setup .NET Core
15 | uses: actions/setup-dotnet@v1
16 | with:
17 | dotnet-version: 6.0.x
18 | - name: Build with dotnet
19 | run: dotnet build --configuration Release
20 | - name: Test with dotnet
21 | run: dotnet test
22 | - name: Pack Nuget
23 | run: dotnet pack DllProps.Tool/DllProps.Tool.csproj
24 | - name: Publish nuget to Nuget.org
25 | run: dotnet nuget push *.nupkg -k ${{ secrets.NUGET_TOKEN }} -s https://api.nuget.org/v3/index.json
26 | - name: Publish nuget to Github
27 | run: |
28 | sed 's/GITHUB_TOKEN/${{ secrets.GITHUB_TOKEN }}/g' .nuget/.nuget.config > nuget.config
29 | dotnet nuget push "*.nupkg" -s "github"
30 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2019 Baruch Odem (Rothkoff)
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.
22 |
--------------------------------------------------------------------------------
/DllProps.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio Version 16
4 | VisualStudioVersion = 16.0.29509.3
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DllProps.Tool", "DllProps.Tool\DllProps.Tool.csproj", "{1B073EF7-D44C-4CBE-B731-C92A9FB18F3D}"
7 | EndProject
8 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DllValidator", "DllValidator\DllValidator.csproj", "{0794DBDE-C2C1-43B7-BC87-5E65885F93B2}"
9 | EndProject
10 | Global
11 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
12 | Debug|Any CPU = Debug|Any CPU
13 | Release|Any CPU = Release|Any CPU
14 | EndGlobalSection
15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
16 | {1B073EF7-D44C-4CBE-B731-C92A9FB18F3D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
17 | {1B073EF7-D44C-4CBE-B731-C92A9FB18F3D}.Debug|Any CPU.Build.0 = Debug|Any CPU
18 | {1B073EF7-D44C-4CBE-B731-C92A9FB18F3D}.Release|Any CPU.ActiveCfg = Release|Any CPU
19 | {1B073EF7-D44C-4CBE-B731-C92A9FB18F3D}.Release|Any CPU.Build.0 = Release|Any CPU
20 | {0794DBDE-C2C1-43B7-BC87-5E65885F93B2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
21 | {0794DBDE-C2C1-43B7-BC87-5E65885F93B2}.Debug|Any CPU.Build.0 = Debug|Any CPU
22 | {0794DBDE-C2C1-43B7-BC87-5E65885F93B2}.Release|Any CPU.ActiveCfg = Release|Any CPU
23 | {0794DBDE-C2C1-43B7-BC87-5E65885F93B2}.Release|Any CPU.Build.0 = Release|Any CPU
24 | EndGlobalSection
25 | GlobalSection(SolutionProperties) = preSolution
26 | HideSolutionNode = FALSE
27 | EndGlobalSection
28 | GlobalSection(ExtensibilityGlobals) = postSolution
29 | SolutionGuid = {06A2AC3C-09C1-4EB5-BACF-AF1224AB1590}
30 | EndGlobalSection
31 | EndGlobal
32 |
--------------------------------------------------------------------------------
/.github/workflows/codeql-analysis.yml:
--------------------------------------------------------------------------------
1 | name: "CodeQL"
2 |
3 | on:
4 | push:
5 | branches: [master, ]
6 | pull_request:
7 | # The branches below must be a subset of the branches above
8 | branches: [master]
9 | schedule:
10 | - cron: '0 4 * * 1'
11 |
12 | jobs:
13 | analyse:
14 | name: Analyse
15 | runs-on: ubuntu-latest
16 |
17 | steps:
18 | - name: Checkout repository
19 | uses: actions/checkout@v2
20 | with:
21 | # We must fetch at least the immediate parents so that if this is
22 | # a pull request then we can checkout the head.
23 | fetch-depth: 2
24 |
25 | # If this run was triggered by a pull request event, then checkout
26 | # the head of the pull request instead of the merge commit.
27 | - run: git checkout HEAD^2
28 | if: ${{ github.event_name == 'pull_request' }}
29 |
30 | # Initializes the CodeQL tools for scanning.
31 | - name: Initialize CodeQL
32 | uses: github/codeql-action/init@v1
33 | # Override language selection by uncommenting this and choosing your languages
34 | # with:
35 | # languages: go, javascript, csharp, python, cpp, java
36 |
37 | # Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
38 | # If this step fails, then you should remove it and run the build manually (see below)
39 | - name: Autobuild
40 | uses: github/codeql-action/autobuild@v1
41 |
42 | # ℹ️ Command-line programs to run using the OS shell.
43 | # 📚 https://git.io/JvXDl
44 |
45 | # ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
46 | # and modify them (or add more) to build your code if your project
47 | # uses a compiled language
48 |
49 | #- run: |
50 | # make bootstrap
51 | # make release
52 |
53 | - name: Perform CodeQL Analysis
54 | uses: github/codeql-action/analyze@v1
55 |
--------------------------------------------------------------------------------
/DllValidator/Program.cs:
--------------------------------------------------------------------------------
1 | using DocoptNet;
2 | using System;
3 | using System.Collections.Generic;
4 | using System.Diagnostics;
5 | using System.IO;
6 | using System.Linq;
7 |
8 | namespace DllValidator
9 | {
10 | class Program
11 | {
12 | private const string usage = @"dll-validator
13 |
14 | Usage:
15 | dll-validator [-r] []
16 |
17 | Options:
18 | -h --help Show this screen.
19 | --version Show version.
20 | ";
21 |
22 | static void Main(string[] args)
23 | {
24 | var arguments = new Docopt().Apply(usage, args, version: "dll-validator alpha", exit: true);
25 |
26 | var validationFile = arguments[""].Value as string;
27 | var whiteList = arguments[""]?.Value as string;
28 | var dir = Path.GetFullPath(arguments[""].Value as string);
29 | var recursive = arguments["-r"].IsTrue ? SearchOption.AllDirectories : SearchOption.TopDirectoryOnly;
30 |
31 | var validations = File.ReadAllLines(validationFile)
32 | .Select(l => l.Split(','))
33 | .Select(a => new { Key = a[0], Value = a[1] });
34 | var dlls = Directory.EnumerateFiles(dir, "*.dll", recursive);
35 |
36 | if (whiteList != null)
37 | {
38 | foreach(var line in File.ReadAllLines(whiteList))
39 | {
40 | var startWith = line[0] != '*';
41 | var endWith = line.Last() != '*';
42 | var contain = !startWith && !endWith;
43 | var pattern = line.Replace("*", "");
44 | if (contain)
45 | {
46 | dlls = dlls.Where(d => !Path.GetFileNameWithoutExtension(d).Contains(pattern));
47 | }
48 | else
49 | {
50 | if (startWith)
51 | {
52 | dlls = dlls.Where(d => !Path.GetFileNameWithoutExtension(d).StartsWith(pattern));
53 | }
54 | if (endWith)
55 | {
56 | dlls = dlls.Where(d => !Path.GetFileNameWithoutExtension(d).EndsWith(pattern));
57 | }
58 | }
59 | }
60 | }
61 |
62 | foreach(var dll in dlls)
63 | {
64 | var fileProperties = new FileProperties(dll);
65 | foreach(var validate in validations)
66 | {
67 | var value = fileProperties[validate.Key];
68 | if(value?.Equals(validate.Value, StringComparison.OrdinalIgnoreCase) != true)
69 | {
70 | Console.WriteLine($"{dll}->{validate.Key}- Expected:'{validate.Value}' Actual:'{value}'");
71 | }
72 | }
73 | }
74 | }
75 | }
76 | }
77 |
--------------------------------------------------------------------------------