diff --git a/README.md b/README.md index 9c2bf1e..dee6ecb 100644 --- a/README.md +++ b/README.md @@ -37,7 +37,7 @@ If you are making use of the [NuGet package](https://www.nuget.org/packages/Brut ```xml + Command=""..\packages\Brutal.Dev.StrongNameSigner.3.0.0\build\StrongNameSigner.Console.exe" -in "..\packages"" /> ``` @@ -57,7 +57,7 @@ To add multiple directories to process at the same time (similar to how the UI c ```xml + Command=""..\packages\Brutal.Dev.StrongNameSigner.3.0.0\build\StrongNameSigner.Console.exe" -in "..\packages\elmah.corelibrary.1.2.2|..\packages\Elmah.MVC.3.0.0"" /> ``` @@ -69,7 +69,7 @@ You can also use wildcards for each of your input directories. The above example ```xml + Command=""..\packages\Brutal.Dev.StrongNameSigner.3.0.0\build\StrongNameSigner.Console.exe" -in "..\packages\elmah.*"" /> ``` @@ -78,7 +78,7 @@ Wildcards can also be complex and placed anywhere in the path. This is useful if ```xml + Command=""..\packages\Brutal.Dev.StrongNameSigner.3.0.0\build\StrongNameSigner.Console.exe" -in "..\packages\Microsoft.*.Security*\*\net45"" /> ``` @@ -104,7 +104,7 @@ For example, ServiceStack's PostgreSQL NuGet package is not signed but other dep ```xml + Command=""..\packages\Brutal.Dev.StrongNameSigner.3.0.0\build\StrongNameSigner.Console.exe" -in "..\packages\ServiceStack.OrmLite.PostgreSQL.4.0.40\lib\net40|..\packages\ServiceStack.Text.Signed.4.0.40\lib\net40|..\packages\ServiceStack.OrmLite.Signed.4.0.40"" /> ``` diff --git a/src/Brutal.Dev.StrongNameSigner.Console/Brutal.Dev.StrongNameSigner.Console.csproj b/src/Brutal.Dev.StrongNameSigner.Console/Brutal.Dev.StrongNameSigner.Console.csproj index 82d095f..bbe22fa 100644 --- a/src/Brutal.Dev.StrongNameSigner.Console/Brutal.Dev.StrongNameSigner.Console.csproj +++ b/src/Brutal.Dev.StrongNameSigner.Console/Brutal.Dev.StrongNameSigner.Console.csproj @@ -1,5 +1,5 @@  - + Debug @@ -9,12 +9,13 @@ Properties Brutal.Dev.StrongNameSigner.Console StrongNameSigner.Console - v4.0 + v4.7.2 512 ..\ true + AnyCPU @@ -25,6 +26,7 @@ DEBUG;TRACE prompt 4 + false AnyCPU @@ -34,6 +36,7 @@ TRACE prompt 4 + false Icon.ico @@ -44,9 +47,10 @@ ..\..\keys\StrongNameSigner.snk + + true + - - ..\..\packages\PowerArgs.2.6.0.1\lib\net40\PowerArgs.dll @@ -54,7 +58,6 @@ - @@ -67,15 +70,16 @@ + + + + {947eecc6-5ebc-4d2a-bac4-8e88b5bafe84} Brutal.Dev.StrongNameSigner - - - diff --git a/src/Brutal.Dev.StrongNameSigner.Console/Properties/AssemblyInfo.cs b/src/Brutal.Dev.StrongNameSigner.Console/Properties/AssemblyInfo.cs index 9119f34..19f7c9e 100644 --- a/src/Brutal.Dev.StrongNameSigner.Console/Properties/AssemblyInfo.cs +++ b/src/Brutal.Dev.StrongNameSigner.Console/Properties/AssemblyInfo.cs @@ -33,5 +33,5 @@ // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("2.9.1.0")] -[assembly: AssemblyFileVersion("2.9.1.0")] +[assembly: AssemblyVersion("3.0.0.0")] +[assembly: AssemblyFileVersion("3.0.0.0")] diff --git a/src/Brutal.Dev.StrongNameSigner.Console/app.config b/src/Brutal.Dev.StrongNameSigner.Console/app.config new file mode 100644 index 0000000..312bb3f --- /dev/null +++ b/src/Brutal.Dev.StrongNameSigner.Console/app.config @@ -0,0 +1,3 @@ + + + diff --git a/src/Brutal.Dev.StrongNameSigner.Console/packages.config b/src/Brutal.Dev.StrongNameSigner.Console/packages.config index f774963..53f10c2 100644 --- a/src/Brutal.Dev.StrongNameSigner.Console/packages.config +++ b/src/Brutal.Dev.StrongNameSigner.Console/packages.config @@ -1,5 +1,5 @@  - - + + \ No newline at end of file diff --git a/src/Brutal.Dev.StrongNameSigner.Setup/StrongNameSigner.iss b/src/Brutal.Dev.StrongNameSigner.Setup/StrongNameSigner.iss index eef850d..2dc7611 100644 --- a/src/Brutal.Dev.StrongNameSigner.Setup/StrongNameSigner.iss +++ b/src/Brutal.Dev.StrongNameSigner.Setup/StrongNameSigner.iss @@ -4,7 +4,7 @@ #define MyAppID "{A89C23E7-A764-4F59-8EF3-5AB0A33E5849}" #define MyAppName ".NET Assembly Strong-Name Signer" #define MyAppNameNoSpaces "StrongNameSigner" -#define MyAppVersion "2.9.1.0" +#define MyAppVersion "3.0.0.0" #define MyAppPublisher "BrutalDev" #define MyAppURL "https://github.com/brutaldev/StrongNameSigner" #define MyAppExeName "StrongNameSigner.exe" @@ -48,17 +48,19 @@ win_sp_title=Windows %1 Service Pack %2 [Files] Source: "..\Brutal.Dev.StrongNameSigner.Docs\output\Help.chm"; DestDir: "{app}"; Flags: ignoreversion replacesameversion -Source: "..\Brutal.Dev.StrongNameSigner\bin\Release\Mono.Cecil.dll"; DestDir: "{app}"; Flags: ignoreversion replacesameversion -Source: "..\Brutal.Dev.StrongNameSigner\bin\Release\Mono.Cecil.Mdb.dll"; DestDir: "{app}"; Flags: ignoreversion replacesameversion -Source: "..\Brutal.Dev.StrongNameSigner\bin\Release\Mono.Cecil.Pdb.dll"; DestDir: "{app}"; Flags: ignoreversion replacesameversion -Source: "..\Brutal.Dev.StrongNameSigner\bin\Release\Mono.Cecil.Rocks.dll"; DestDir: "{app}"; Flags: ignoreversion replacesameversion -Source: "..\Brutal.Dev.StrongNameSigner\bin\Release\Brutal.Dev.StrongNameSigner.XML"; DestDir: "{app}"; Flags: ignoreversion replacesameversion -Source: "..\Brutal.Dev.StrongNameSigner\bin\Release\Brutal.Dev.StrongNameSigner.dll"; DestDir: "{app}"; Flags: ignoreversion replacesameversion +Source: "..\Brutal.Dev.StrongNameSigner\bin\Release\netstandard2.0\publish\Mono.Cecil.dll"; DestDir: "{app}"; Flags: ignoreversion replacesameversion +Source: "..\Brutal.Dev.StrongNameSigner\bin\Release\netstandard2.0\publish\Mono.Cecil.Mdb.dll"; DestDir: "{app}"; Flags: ignoreversion replacesameversion +Source: "..\Brutal.Dev.StrongNameSigner\bin\Release\netstandard2.0\publish\Mono.Cecil.Pdb.dll"; DestDir: "{app}"; Flags: ignoreversion replacesameversion +Source: "..\Brutal.Dev.StrongNameSigner\bin\Release\netstandard2.0\publish\Mono.Cecil.Rocks.dll"; DestDir: "{app}"; Flags: ignoreversion replacesameversion +Source: "..\Brutal.Dev.StrongNameSigner\bin\Release\netstandard2.0\publish\Brutal.Dev.StrongNameSigner.XML"; DestDir: "{app}"; Flags: ignoreversion replacesameversion +Source: "..\Brutal.Dev.StrongNameSigner\bin\Release\netstandard2.0\publish\Brutal.Dev.StrongNameSigner.dll"; DestDir: "{app}"; Flags: ignoreversion replacesameversion Source: "..\Brutal.Dev.StrongNameSigner.Console\bin\Release\StrongNameSigner.Console.exe"; DestDir: "{app}"; Flags: ignoreversion replacesameversion; Components: Console +Source: "..\Brutal.Dev.StrongNameSigner.Console\bin\Release\StrongNameSigner.Console.exe.config"; DestDir: "{app}"; Flags: ignoreversion replacesameversion; Components: Console Source: "..\Brutal.Dev.StrongNameSigner.Console\bin\Release\PowerArgs.dll"; DestDir: "{app}"; Flags: ignoreversion replacesameversion; Components: Console Source: "..\Brutal.Dev.StrongNameSigner.UI\bin\Release\Microsoft.WindowsAPICodePack.dll"; DestDir: "{app}"; Flags: ignoreversion replacesameversion; Components: UserInterface Source: "..\Brutal.Dev.StrongNameSigner.UI\bin\Release\Microsoft.WindowsAPICodePack.Shell.dll"; DestDir: "{app}"; Flags: ignoreversion replacesameversion; Components: UserInterface Source: "..\Brutal.Dev.StrongNameSigner.UI\bin\Release\StrongNameSigner.exe"; DestDir: "{app}"; Flags: ignoreversion replacesameversion; Components: UserInterface +Source: "..\Brutal.Dev.StrongNameSigner.UI\bin\Release\StrongNameSigner.exe.config"; DestDir: "{app}"; Flags: ignoreversion replacesameversion; Components: UserInterface [Icons] Name: "{group}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Components: UserInterface diff --git a/src/Brutal.Dev.StrongNameSigner.Setup/StrongNameSigner.nuspec b/src/Brutal.Dev.StrongNameSigner.Setup/StrongNameSigner.nuspec index 7a7c29a..01b061d 100644 --- a/src/Brutal.Dev.StrongNameSigner.Setup/StrongNameSigner.nuspec +++ b/src/Brutal.Dev.StrongNameSigner.Setup/StrongNameSigner.nuspec @@ -2,7 +2,7 @@ Brutal.Dev.StrongNameSigner - 2.9.1 + 3.0.0-beta .NET Assembly Strong-Name Signer Werner van Deventer Werner van Deventer @@ -20,22 +20,22 @@ If you strong-name sign your own projects you may have noticed that if you refer The tool will also re-write the assembly references (as well as any InternalsVisibleTo references) to match the new signed versions of the assemblies you create. Automatic strong-name signing of referenced assemblies. Utility software to strong-name sign .NET assemblies, including assemblies you do not have the source code for. - - Update to the latest Mono Cecil which fixes a number of issues that can only make things better. -- Fix issues #66. -- Remove validation for missing key file (will generate one). + +- Fix issue #52. Werner van Deventer (https://brutaldev.com) en-US strongname assembly gac unsigned strong name automatic - - - - - - + + + + + + + diff --git a/src/Brutal.Dev.StrongNameSigner.TestAssembly.Core5/Brutal.Dev.StrongNameSigner.TestAssembly.Core5.csproj b/src/Brutal.Dev.StrongNameSigner.TestAssembly.Core5/Brutal.Dev.StrongNameSigner.TestAssembly.Core5.csproj new file mode 100644 index 0000000..89631f5 --- /dev/null +++ b/src/Brutal.Dev.StrongNameSigner.TestAssembly.Core5/Brutal.Dev.StrongNameSigner.TestAssembly.Core5.csproj @@ -0,0 +1,5 @@ + + + net5.0 + + \ No newline at end of file diff --git a/src/Brutal.Dev.StrongNameSigner.TestAssembly.Core5/C5.cs b/src/Brutal.Dev.StrongNameSigner.TestAssembly.Core5/C5.cs new file mode 100644 index 0000000..afaadb2 --- /dev/null +++ b/src/Brutal.Dev.StrongNameSigner.TestAssembly.Core5/C5.cs @@ -0,0 +1,10 @@ +namespace Brutal.Dev.StrongNameSigner.TestAssembly.Core5 +{ + public class C5 + { + public C5() + { + + } + } +} diff --git a/src/Brutal.Dev.StrongNameSigner.Tests/Brutal.Dev.StrongNameSigner.Tests.csproj b/src/Brutal.Dev.StrongNameSigner.Tests/Brutal.Dev.StrongNameSigner.Tests.csproj index 6c3c4c8..33544a3 100644 --- a/src/Brutal.Dev.StrongNameSigner.Tests/Brutal.Dev.StrongNameSigner.Tests.csproj +++ b/src/Brutal.Dev.StrongNameSigner.Tests/Brutal.Dev.StrongNameSigner.Tests.csproj @@ -1,5 +1,5 @@  - + @@ -10,7 +10,7 @@ Properties Brutal.Dev.StrongNameSigner.Tests Brutal.Dev.StrongNameSigner.Tests - v4.0 + v4.7.2 512 {3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} 10.0 @@ -22,6 +22,7 @@ true + true @@ -31,6 +32,7 @@ DEBUG;TRACE prompt 4 + false pdbonly @@ -39,6 +41,7 @@ TRACE prompt 4 + false true @@ -47,15 +50,24 @@ ..\..\keys\StrongNameSigner.snk - - + + ..\..\packages\Mono.Cecil.0.11.4\lib\net40\Mono.Cecil.dll + + + ..\..\packages\Mono.Cecil.0.11.4\lib\net40\Mono.Cecil.Mdb.dll + + + ..\..\packages\Mono.Cecil.0.11.4\lib\net40\Mono.Cecil.Pdb.dll + + + ..\..\packages\Mono.Cecil.0.11.4\lib\net40\Mono.Cecil.Rocks.dll + - ..\..\packages\NUnit.3.13.2\lib\net40\nunit.framework.dll - True + ..\..\packages\NUnit.3.13.2\lib\net45\nunit.framework.dll - ..\..\packages\Shouldly.3.0.2\lib\net40\Shouldly.dll + ..\..\packages\Shouldly.3.0.2\lib\net451\Shouldly.dll @@ -78,6 +90,9 @@ + + PreserveNewest + Always @@ -174,6 +189,14 @@ Brutal.Dev.StrongNameSigner + + + PreserveNewest + + + PreserveNewest + + diff --git a/src/Brutal.Dev.StrongNameSigner.Tests/SignAssemblyTests.cs b/src/Brutal.Dev.StrongNameSigner.Tests/SignAssemblyTests.cs index b3eccff..0f23138 100644 --- a/src/Brutal.Dev.StrongNameSigner.Tests/SignAssemblyTests.cs +++ b/src/Brutal.Dev.StrongNameSigner.Tests/SignAssemblyTests.cs @@ -144,6 +144,18 @@ public void SignAssembly_Should_Reassemble_NET_40_x64_Assembly_Correctly() info.IsSigned.ShouldBe(true); } + [Test] + public void SignAssembly_Should_Reassemble_Core_5_Assembly_Correctly() + { + var info = SigningHelper.SignAssembly(Path.Combine(TestAssemblyDirectory, "Brutal.Dev.StrongNameSigner.TestAssembly.Core5.dll"), string.Empty, Path.Combine(TestAssemblyDirectory, "Signed")); + info.DotNetVersion.ShouldBe("4.0.30319"); + info.IsAnyCpu.ShouldBe(true); + info.Is32BitOnly.ShouldBe(false); + info.Is32BitPreferred.ShouldBe(false); + info.Is64BitOnly.ShouldBe(false); + info.IsSigned.ShouldBe(true); + } + [Test] public void SignAssembly_InPlaceWithPdb_Should_Succeed() { diff --git a/src/Brutal.Dev.StrongNameSigner.Tests/TestAssemblies/Brutal.Dev.StrongNameSigner.TestAssembly.Core5.deps.json b/src/Brutal.Dev.StrongNameSigner.Tests/TestAssemblies/Brutal.Dev.StrongNameSigner.TestAssembly.Core5.deps.json new file mode 100644 index 0000000..d351051 --- /dev/null +++ b/src/Brutal.Dev.StrongNameSigner.Tests/TestAssemblies/Brutal.Dev.StrongNameSigner.TestAssembly.Core5.deps.json @@ -0,0 +1,23 @@ +{ + "runtimeTarget": { + "name": ".NETCoreApp,Version=v5.0", + "signature": "" + }, + "compilationOptions": {}, + "targets": { + ".NETCoreApp,Version=v5.0": { + "Brutal.Dev.StrongNameSigner.TestAssembly.Core5/1.0.0": { + "runtime": { + "Brutal.Dev.StrongNameSigner.TestAssembly.Core5.dll": {} + } + } + } + }, + "libraries": { + "Brutal.Dev.StrongNameSigner.TestAssembly.Core5/1.0.0": { + "type": "project", + "serviceable": false, + "sha512": "" + } + } +} \ No newline at end of file diff --git a/src/Brutal.Dev.StrongNameSigner.Tests/TestAssemblies/Brutal.Dev.StrongNameSigner.TestAssembly.Core5.dll b/src/Brutal.Dev.StrongNameSigner.Tests/TestAssemblies/Brutal.Dev.StrongNameSigner.TestAssembly.Core5.dll new file mode 100644 index 0000000..06d685f Binary files /dev/null and b/src/Brutal.Dev.StrongNameSigner.Tests/TestAssemblies/Brutal.Dev.StrongNameSigner.TestAssembly.Core5.dll differ diff --git a/src/Brutal.Dev.StrongNameSigner.Tests/TestAssemblies/Brutal.Dev.StrongNameSigner.TestAssembly.Core5.pdb b/src/Brutal.Dev.StrongNameSigner.Tests/TestAssemblies/Brutal.Dev.StrongNameSigner.TestAssembly.Core5.pdb new file mode 100644 index 0000000..d7eaeff Binary files /dev/null and b/src/Brutal.Dev.StrongNameSigner.Tests/TestAssemblies/Brutal.Dev.StrongNameSigner.TestAssembly.Core5.pdb differ diff --git a/src/Brutal.Dev.StrongNameSigner.Tests/packages.config b/src/Brutal.Dev.StrongNameSigner.Tests/packages.config index 7921709..8e3cc75 100644 --- a/src/Brutal.Dev.StrongNameSigner.Tests/packages.config +++ b/src/Brutal.Dev.StrongNameSigner.Tests/packages.config @@ -1,6 +1,7 @@  - - - + + + + \ No newline at end of file diff --git a/src/Brutal.Dev.StrongNameSigner.UI/Brutal.Dev.StrongNameSigner.UI.csproj b/src/Brutal.Dev.StrongNameSigner.UI/Brutal.Dev.StrongNameSigner.UI.csproj index 4c77c8d..0357d0e 100644 --- a/src/Brutal.Dev.StrongNameSigner.UI/Brutal.Dev.StrongNameSigner.UI.csproj +++ b/src/Brutal.Dev.StrongNameSigner.UI/Brutal.Dev.StrongNameSigner.UI.csproj @@ -1,5 +1,5 @@  - + Debug @@ -9,7 +9,7 @@ Properties Brutal.Dev.StrongNameSigner.UI StrongNameSigner - v4.0 + v4.7.2 512 publish\ true @@ -30,6 +30,7 @@ true + AnyCPU @@ -40,6 +41,7 @@ DEBUG;TRACE prompt 4 + false AnyCPU @@ -49,6 +51,7 @@ TRACE prompt 4 + false true @@ -60,12 +63,10 @@ Icon.ico - - - + ..\..\packages\Windows7APICodePack-Core.1.1.0.0\lib\Microsoft.WindowsAPICodePack.dll - + ..\..\packages\Windows7APICodePack-Shell.1.1.0.0\lib\Microsoft.WindowsAPICodePack.Shell.dll @@ -112,6 +113,7 @@ Resources.resx True + SettingsSingleFileGenerator @@ -162,6 +164,9 @@ OnOutputUpdated + + true + diff --git a/src/Brutal.Dev.StrongNameSigner.UI/Properties/AssemblyInfo.cs b/src/Brutal.Dev.StrongNameSigner.UI/Properties/AssemblyInfo.cs index 66e6e60..791505e 100644 --- a/src/Brutal.Dev.StrongNameSigner.UI/Properties/AssemblyInfo.cs +++ b/src/Brutal.Dev.StrongNameSigner.UI/Properties/AssemblyInfo.cs @@ -33,5 +33,5 @@ // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("2.9.1.0")] -[assembly: AssemblyFileVersion("2.9.1.0")] +[assembly: AssemblyVersion("3.0.0.0")] +[assembly: AssemblyFileVersion("3.0.0.0")] diff --git a/src/Brutal.Dev.StrongNameSigner.UI/Properties/Resources.Designer.cs b/src/Brutal.Dev.StrongNameSigner.UI/Properties/Resources.Designer.cs index b764f48..b83447f 100644 --- a/src/Brutal.Dev.StrongNameSigner.UI/Properties/Resources.Designer.cs +++ b/src/Brutal.Dev.StrongNameSigner.UI/Properties/Resources.Designer.cs @@ -1,7 +1,7 @@ //------------------------------------------------------------------------------ // // This code was generated by a tool. -// Runtime Version:4.0.30319.33440 +// Runtime Version:4.0.30319.42000 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. @@ -19,7 +19,7 @@ namespace Brutal.Dev.StrongNameSigner.UI.Properties { // class via a tool like ResGen or Visual Studio. // To add or remove a member, edit your .ResX file then rerun ResGen // with the /str option, or rebuild your VS project. - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] internal class Resources { diff --git a/src/Brutal.Dev.StrongNameSigner.UI/Properties/Settings.Designer.cs b/src/Brutal.Dev.StrongNameSigner.UI/Properties/Settings.Designer.cs index 761f443..b993369 100644 --- a/src/Brutal.Dev.StrongNameSigner.UI/Properties/Settings.Designer.cs +++ b/src/Brutal.Dev.StrongNameSigner.UI/Properties/Settings.Designer.cs @@ -1,30 +1,26 @@ //------------------------------------------------------------------------------ // // This code was generated by a tool. -// Runtime Version:4.0.30319.33440 +// Runtime Version:4.0.30319.42000 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // //------------------------------------------------------------------------------ -namespace Brutal.Dev.StrongNameSigner.UI.Properties -{ - - - [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")] - internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase - { - - private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); - - public static Settings Default - { - get - { - return defaultInstance; - } +namespace Brutal.Dev.StrongNameSigner.UI.Properties { + + + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.0.3.0")] + internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { + + private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); + + public static Settings Default { + get { + return defaultInstance; + } + } } - } } diff --git a/src/Brutal.Dev.StrongNameSigner.UI/app.config b/src/Brutal.Dev.StrongNameSigner.UI/app.config new file mode 100644 index 0000000..312bb3f --- /dev/null +++ b/src/Brutal.Dev.StrongNameSigner.UI/app.config @@ -0,0 +1,3 @@ + + + diff --git a/src/Brutal.Dev.StrongNameSigner.UI/packages.config b/src/Brutal.Dev.StrongNameSigner.UI/packages.config index 408faa1..485d922 100644 --- a/src/Brutal.Dev.StrongNameSigner.UI/packages.config +++ b/src/Brutal.Dev.StrongNameSigner.UI/packages.config @@ -1,6 +1,6 @@  - - - + + + \ No newline at end of file diff --git a/src/Brutal.Dev.StrongNameSigner.sln b/src/Brutal.Dev.StrongNameSigner.sln index a53364e..c2ee414 100644 --- a/src/Brutal.Dev.StrongNameSigner.sln +++ b/src/Brutal.Dev.StrongNameSigner.sln @@ -1,9 +1,9 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 15 -VisualStudioVersion = 15.0.26730.12 +# Visual Studio Version 17 +VisualStudioVersion = 17.0.31912.275 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Brutal.Dev.StrongNameSigner", "Brutal.Dev.StrongNameSigner\Brutal.Dev.StrongNameSigner.csproj", "{947EECC6-5EBC-4D2A-BAC4-8E88B5BAFE84}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Brutal.Dev.StrongNameSigner", "Brutal.Dev.StrongNameSigner\Brutal.Dev.StrongNameSigner.csproj", "{947EECC6-5EBC-4D2A-BAC4-8E88B5BAFE84}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Brutal.Dev.StrongNameSigner.Tests", "Brutal.Dev.StrongNameSigner.Tests\Brutal.Dev.StrongNameSigner.Tests.csproj", "{3EA13C51-9A22-4045-8993-12391408A300}" EndProject @@ -37,6 +37,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Brutal.Dev.StrongNameSigner\StrongNameSigner.targets = Brutal.Dev.StrongNameSigner\StrongNameSigner.targets EndProjectSection EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Brutal.Dev.StrongNameSigner.TestAssembly.Core5", "Brutal.Dev.StrongNameSigner.TestAssembly.Core5\Brutal.Dev.StrongNameSigner.TestAssembly.Core5.csproj", "{93BD3735-66AD-4741-8F10-9B5367171FE4}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -75,6 +77,10 @@ Global {1DACFD7E-47BA-4B8E-83AF-5580E3EFC744}.Debug|Any CPU.Build.0 = Debug|Any CPU {1DACFD7E-47BA-4B8E-83AF-5580E3EFC744}.Release|Any CPU.ActiveCfg = Release|Any CPU {1DACFD7E-47BA-4B8E-83AF-5580E3EFC744}.Release|Any CPU.Build.0 = Release|Any CPU + {93BD3735-66AD-4741-8F10-9B5367171FE4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {93BD3735-66AD-4741-8F10-9B5367171FE4}.Debug|Any CPU.Build.0 = Debug|Any CPU + {93BD3735-66AD-4741-8F10-9B5367171FE4}.Release|Any CPU.ActiveCfg = Release|Any CPU + {93BD3735-66AD-4741-8F10-9B5367171FE4}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/src/Brutal.Dev.StrongNameSigner/AutomaticBuildTask.cs b/src/Brutal.Dev.StrongNameSigner/AutomaticBuildTask.cs index ee4feb4..fddb43f 100644 --- a/src/Brutal.Dev.StrongNameSigner/AutomaticBuildTask.cs +++ b/src/Brutal.Dev.StrongNameSigner/AutomaticBuildTask.cs @@ -101,7 +101,7 @@ public override bool Execute() } } - if (signedAssembly != null && signedAssembly.IsSigned) + if (signedAssembly?.IsSigned == true) { signedAssemblyPaths.Add(signedAssembly.FilePath); processedAssemblyPaths.Add(signedAssembly.FilePath); @@ -145,11 +145,12 @@ public override bool Execute() NewCopyLocalFiles = new ITaskItem[CopyLocalPaths.Length]; for (int i = 0; i < CopyLocalPaths.Length; i++) { - string updatedPath; - if (updatedReferencePaths.TryGetValue(CopyLocalPaths[i].ItemSpec, out updatedPath)) + if (updatedReferencePaths.TryGetValue(CopyLocalPaths[i].ItemSpec, out string updatedPath)) { - NewCopyLocalFiles[i] = new TaskItem(CopyLocalPaths[i]); - NewCopyLocalFiles[i].ItemSpec = updatedPath; + NewCopyLocalFiles[i] = new TaskItem(CopyLocalPaths[i]) + { + ItemSpec = updatedPath + }; } else { diff --git a/src/Brutal.Dev.StrongNameSigner/Brutal.Dev.StrongNameSigner.csproj b/src/Brutal.Dev.StrongNameSigner/Brutal.Dev.StrongNameSigner.csproj index 20826ca..c837e69 100644 --- a/src/Brutal.Dev.StrongNameSigner/Brutal.Dev.StrongNameSigner.csproj +++ b/src/Brutal.Dev.StrongNameSigner/Brutal.Dev.StrongNameSigner.csproj @@ -1,104 +1,22 @@ - - - - - Debug - AnyCPU - {947EECC6-5EBC-4D2A-BAC4-8E88B5BAFE84} - Library - Properties - Brutal.Dev.StrongNameSigner - Brutal.Dev.StrongNameSigner - v4.0 - 512 - OnOutputUpdated - ..\ - true - - - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - AllRules.ruleset - - - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - false - AllRules.ruleset - bin\Release\Brutal.Dev.StrongNameSigner.XML - - - true - + + + netstandard2.0 + Brutal.Dev.StrongNameSigner + 3.0.0.0 + Simple API to sign .NET assemblies with a strong-name key and fix assembly references. + Copyright © 2013-2021 + https://brutaldev.com/post/net-assembly-strong-name-signer + https://github.com/brutaldev/StrongNameSigner/ + latest + True ..\..\keys\StrongNameSigner.snk + True + - - - - ..\..\packages\Mono.Cecil.0.11.4\lib\net40\Mono.Cecil.dll - - - ..\..\packages\Mono.Cecil.0.11.4\lib\net40\Mono.Cecil.Mdb.dll - - - ..\..\packages\Mono.Cecil.0.11.4\lib\net40\Mono.Cecil.Pdb.dll - - - ..\..\packages\Mono.Cecil.0.11.4\lib\net40\Mono.Cecil.Rocks.dll - - - - - - - - - - - - - - - - - - - - - - PreserveNewest - Designer - + + + - - - - - - - This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. - - - \ No newline at end of file diff --git a/src/Brutal.Dev.StrongNameSigner/ForceAssemblyReferenceAttribute.cs b/src/Brutal.Dev.StrongNameSigner/ForceAssemblyReferenceAttribute.cs index 1b06613..ad50e8f 100644 --- a/src/Brutal.Dev.StrongNameSigner/ForceAssemblyReferenceAttribute.cs +++ b/src/Brutal.Dev.StrongNameSigner/ForceAssemblyReferenceAttribute.cs @@ -1,4 +1,13 @@ using System; +using Brutal.Dev.StrongNameSigner; + +// These assemblies are used by Cecil, and reading assemblies with symbols without these DLL's present +// will cause an error ("No Symbols Found"). So to ensure that these are actually referenced by +// StrongNameSigner and copied along to the output directory as well as the UnitTests when running +// them, we use this "hack". +[assembly: ForceAssemblyReference(typeof(Mono.Cecil.Pdb.NativePdbReader))] +[assembly: ForceAssemblyReference(typeof(Mono.Cecil.Mdb.MdbReader))] +[assembly: ForceAssemblyReference(typeof(Mono.Cecil.Rocks.TypeDefinitionRocks))] namespace Brutal.Dev.StrongNameSigner { @@ -11,7 +20,7 @@ internal sealed class ForceAssemblyReferenceAttribute : Attribute // https://stackoverflow.com/questions/15816769/dependent-dll-is-not-getting-copied-to-the-build-output-folder-in-visual-studio public ForceAssemblyReferenceAttribute(Type forcedType) { - Action noop = _ => { }; + void noop(Type _) { } noop(forcedType); } } diff --git a/src/Brutal.Dev.StrongNameSigner/Properties/AssemblyInfo.cs b/src/Brutal.Dev.StrongNameSigner/Properties/AssemblyInfo.cs deleted file mode 100644 index 2ea378d..0000000 --- a/src/Brutal.Dev.StrongNameSigner/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,46 +0,0 @@ -using System; -using System.Reflection; -using System.Runtime.InteropServices; -using Brutal.Dev.StrongNameSigner; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("Brutal.Dev.StrongNameSigner")] -[assembly: AssemblyDescription("Simple API to sign .NET assemblies with a strong-name key and fix assembly references.")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("https://brutaldev.com")] -[assembly: AssemblyProduct("Brutal.Dev.StrongNameSigner")] -[assembly: AssemblyCopyright("Copyright © 2013-2021")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] -[assembly: CLSCompliant(true)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("64d853c0-07b2-4891-8f9a-352c00669028")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Build and Revision Numbers -// by using the '*' as shown below: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("2.9.1.0")] -[assembly: AssemblyFileVersion("2.9.1.0")] - -// These assemblies are used by Cecil, and reading assemblies with symbols without these DLL's present -// will cause an error ("No Symbols Found"). So to ensure that these are actually referenced by -// StrongNameSigner and copied along to the output directory as well as the UnitTests when running -// them, we use this "hack". -[assembly: ForceAssemblyReference(typeof(Mono.Cecil.Pdb.NativePdbReader))] -[assembly: ForceAssemblyReference(typeof(Mono.Cecil.Mdb.MdbReader))] -[assembly: ForceAssemblyReference(typeof(Mono.Cecil.Rocks.TypeDefinitionRocks))] diff --git a/src/Brutal.Dev.StrongNameSigner/SigningHelper.cs b/src/Brutal.Dev.StrongNameSigner/SigningHelper.cs index b921837..75a74e9 100644 --- a/src/Brutal.Dev.StrongNameSigner/SigningHelper.cs +++ b/src/Brutal.Dev.StrongNameSigner/SigningHelper.cs @@ -29,9 +29,7 @@ public static class SigningHelper /// A strong-name key pair array. public static byte[] GenerateStrongNameKeyPair() { -#pragma warning disable S4426 // Cryptographic keys should not be too short using (var provider = new RSACryptoServiceProvider(1024, new CspParameters() { KeyNumber = 2 })) -#pragma warning restore S4426 // Cryptographic keys should not be too short { return provider.ExportCspBlob(!provider.PublicOnly); } @@ -294,7 +292,7 @@ public static bool FixAssemblyReference(string assemblyPath, string referenceAss // Found a matching reference, let's set the public key token. if (assemblyReference != null && BitConverter.ToString(assemblyReference.PublicKeyToken) != BitConverter.ToString(b.Name.PublicKeyToken)) { - assemblyReference.PublicKeyToken = b.Name.PublicKeyToken ?? new byte[0]; + assemblyReference.PublicKeyToken = b.Name.PublicKeyToken ?? Array.Empty(); assemblyReference.Version = b.Name.Version; if (!a.Name.IsRetargetable) diff --git a/src/Brutal.Dev.StrongNameSigner/StrongNameType.cs b/src/Brutal.Dev.StrongNameSigner/StrongNameType.cs index d12bab8..6e84f64 100644 --- a/src/Brutal.Dev.StrongNameSigner/StrongNameType.cs +++ b/src/Brutal.Dev.StrongNameSigner/StrongNameType.cs @@ -13,7 +13,7 @@ public enum StrongNameType /// /// The assembly contains a public key but is not actually signed. /// - /// + /// /// Additional documentation on delay-signing. /// DelaySigned,