From 7368aa0f751308662d27335a617b5e2cef020082 Mon Sep 17 00:00:00 2001 From: Werner van Deventer Date: Thu, 7 Jan 2016 12:54:43 +0200 Subject: [PATCH] Use probing paths when signing as well. --- README.md | 6 +++--- sonar-project.properties | 2 +- src/Brutal.Dev.StrongNameSigner.Console/Program.cs | 11 ++++++----- .../Properties/AssemblyInfo.cs | 4 ++-- src/Brutal.Dev.StrongNameSigner.Setup/EULA.txt | 2 +- .../StrongNameSigner.iss | 2 +- .../StrongNameSigner.nuspec | 4 ++-- src/Brutal.Dev.StrongNameSigner.UI/MainForm.cs | 2 +- .../Properties/AssemblyInfo.cs | 4 ++-- .../Properties/AssemblyInfo.cs | 4 ++-- 10 files changed, 21 insertions(+), 20 deletions(-) diff --git a/README.md b/README.md index 611c573..af44193 100644 --- a/README.md +++ b/README.md @@ -34,7 +34,7 @@ If you are making use of the [NuGet package](https://www.nuget.org/packages/Brut ```xml + Command=""..\packages\Brutal.Dev.StrongNameSigner.1.6.1\tools\StrongNameSigner.Console.exe" -in "..\packages"" /> ``` @@ -46,7 +46,7 @@ To add multiple directories to process at the same time (similar to how the UI c ```xml + Command=""..\packages\Brutal.Dev.StrongNameSigner.1.6.1\tools\StrongNameSigner.Console.exe" -in "..\packages\elmah.corelibrary.1.2.2|..\packages\Elmah.MVC.2.1.1"" /> ``` @@ -75,7 +75,7 @@ For example, ServiceStack's PostgreSQL NuGet package is not signed but other dep ```xml + Command=""..\packages\Brutal.Dev.StrongNameSigner.1.6.1\tools\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/sonar-project.properties b/sonar-project.properties index 780e83d..7d01501 100644 --- a/sonar-project.properties +++ b/sonar-project.properties @@ -1,6 +1,6 @@ # required metadata sonar.projectKey=Brutal:Dev:StrongNameSigner -sonar.projectVersion=1.5.1 +sonar.projectVersion=1.6.1 sonar.projectName=Strong Name Signer # optional description diff --git a/src/Brutal.Dev.StrongNameSigner.Console/Program.cs b/src/Brutal.Dev.StrongNameSigner.Console/Program.cs index de2480c..f792b48 100644 --- a/src/Brutal.Dev.StrongNameSigner.Console/Program.cs +++ b/src/Brutal.Dev.StrongNameSigner.Console/Program.cs @@ -125,10 +125,11 @@ private static Stats SignAssemblies(Options options) var processedAssemblyPaths = new HashSet(StringComparer.OrdinalIgnoreCase); var signedAssemblyPaths = new HashSet(StringComparer.OrdinalIgnoreCase); + var probingPaths = filesToSign.Select(f => Path.GetDirectoryName(f)).Distinct().ToArray(); foreach (var filePath in filesToSign) { - var signedAssembly = SignSingleAssembly(filePath, options.KeyFile, options.OutputDirectory, options.Password); + var signedAssembly = SignSingleAssembly(filePath, options.KeyFile, options.OutputDirectory, options.Password, probingPaths); if (signedAssembly != null) { processedAssemblyPaths.Add(signedAssembly.FilePath); @@ -147,7 +148,7 @@ private static Stats SignAssemblies(Options options) // Go through all the references excluding the file we are working on. foreach (var referencePath in referencesToFix.Where(r => !r.Equals(filePath))) { - if (FixSingleAssemblyReference(filePath, referencePath, options.KeyFile, options.Password, filesToSign.Select(f => Path.GetDirectoryName(f)).Distinct().ToArray())) + if (FixSingleAssemblyReference(filePath, referencePath, options.KeyFile, options.Password, probingPaths)) { referenceFixes++; } @@ -157,7 +158,7 @@ private static Stats SignAssemblies(Options options) // Remove all InternalsVisibleTo attributes without public keys from the processed assemblies. Signed assemblies cannot have unsigned friend assemblies. foreach (var filePath in signedAssemblyPaths) { - if (RemoveInvalidFriendAssemblyReferences(filePath, options.KeyFile, options.Password, filesToSign.Select(f => Path.GetDirectoryName(f)).Distinct().ToArray())) + if (RemoveInvalidFriendAssemblyReferences(filePath, options.KeyFile, options.Password, probingPaths)) { referenceFixes++; } @@ -170,7 +171,7 @@ private static Stats SignAssemblies(Options options) }; } - private static AssemblyInfo SignSingleAssembly(string assemblyPath, string keyPath, string outputDirectory, string password) + private static AssemblyInfo SignSingleAssembly(string assemblyPath, string keyPath, string outputDirectory, string password, params string[] probingPaths) { try { @@ -180,7 +181,7 @@ private static AssemblyInfo SignSingleAssembly(string assemblyPath, string keyPa var info = SigningHelper.GetAssemblyInfo(assemblyPath); if (!info.IsSigned) { - info = SigningHelper.SignAssembly(assemblyPath, keyPath, outputDirectory, password); + info = SigningHelper.SignAssembly(assemblyPath, keyPath, outputDirectory, password, probingPaths); PrintMessageColor(string.Format("'{0}' was strong-name signed successfully.", info.FilePath), LogLevel.Changes, ConsoleColor.Green); diff --git a/src/Brutal.Dev.StrongNameSigner.Console/Properties/AssemblyInfo.cs b/src/Brutal.Dev.StrongNameSigner.Console/Properties/AssemblyInfo.cs index 7cd9fe9..c239a0d 100644 --- a/src/Brutal.Dev.StrongNameSigner.Console/Properties/AssemblyInfo.cs +++ b/src/Brutal.Dev.StrongNameSigner.Console/Properties/AssemblyInfo.cs @@ -34,5 +34,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("1.5.1.0")] -[assembly: AssemblyFileVersion("1.5.1.0")] +[assembly: AssemblyVersion("1.6.1.0")] +[assembly: AssemblyFileVersion("1.6.1.0")] diff --git a/src/Brutal.Dev.StrongNameSigner.Setup/EULA.txt b/src/Brutal.Dev.StrongNameSigner.Setup/EULA.txt index e885e3b..820b9b5 100644 --- a/src/Brutal.Dev.StrongNameSigner.Setup/EULA.txt +++ b/src/Brutal.Dev.StrongNameSigner.Setup/EULA.txt @@ -1,4 +1,4 @@ -Copyright (c) 2013-2015 Werner van Deventer (werner@brutaldev.com) +Copyright (c) 2013-2016 Werner van Deventer (werner@brutaldev.com) All rights reserved. * Redistribution of source code is strictly prohibited by means of reverse engineering or otherwise. diff --git a/src/Brutal.Dev.StrongNameSigner.Setup/StrongNameSigner.iss b/src/Brutal.Dev.StrongNameSigner.Setup/StrongNameSigner.iss index 4faf738..980905a 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 "1.5.1.0" +#define MyAppVersion "1.6.1.0" #define MyAppPublisher "BrutalDev" #define MyAppURL "https://github.com/brutaldev/StrongNameSigner" #define MyAppExeName "StrongNameSigner.exe" diff --git a/src/Brutal.Dev.StrongNameSigner.Setup/StrongNameSigner.nuspec b/src/Brutal.Dev.StrongNameSigner.Setup/StrongNameSigner.nuspec index 25f2821..7578d30 100644 --- a/src/Brutal.Dev.StrongNameSigner.Setup/StrongNameSigner.nuspec +++ b/src/Brutal.Dev.StrongNameSigner.Setup/StrongNameSigner.nuspec @@ -2,7 +2,7 @@ Brutal.Dev.StrongNameSigner - 1.5.1 + 1.6.1 .NET Assembly Strong-Name Signer Werner van Deventer Werner van Deventer @@ -19,7 +19,7 @@ The tool will also re-write the assembly references (as well as any InternalsVis Cache generated strong-name keys to ensure all assemblies are signed with the same key pair. This ensure they are not invalidated when references are fixed and they get re-signed. Werner van Deventer (https://brutaldev.com) en-US - strongname assembly gac unsigned + strongname assembly gac unsigned strong name diff --git a/src/Brutal.Dev.StrongNameSigner.UI/MainForm.cs b/src/Brutal.Dev.StrongNameSigner.UI/MainForm.cs index 96cbebb..d65995d 100644 --- a/src/Brutal.Dev.StrongNameSigner.UI/MainForm.cs +++ b/src/Brutal.Dev.StrongNameSigner.UI/MainForm.cs @@ -376,7 +376,7 @@ private void BackgroundWorkerDoWork(object sender, DoWorkEventArgs e) assemblyPair.OldInfo = SigningHelper.GetAssemblyInfo(filePath); if (!assemblyPair.OldInfo.IsSigned) { - assemblyPair.NewInfo = SigningHelper.SignAssembly(filePath, keyFile, outputPath, password); + assemblyPair.NewInfo = SigningHelper.SignAssembly(filePath, keyFile, outputPath, password, assemblyPaths.Select(f => Path.GetDirectoryName(f)).Distinct().ToArray()); log.Append("Strong-name signed successfully.").AppendLine(); signedAssemblyPaths.Add(filePath); signedFiles++; diff --git a/src/Brutal.Dev.StrongNameSigner.UI/Properties/AssemblyInfo.cs b/src/Brutal.Dev.StrongNameSigner.UI/Properties/AssemblyInfo.cs index 72d5116..54dc859 100644 --- a/src/Brutal.Dev.StrongNameSigner.UI/Properties/AssemblyInfo.cs +++ b/src/Brutal.Dev.StrongNameSigner.UI/Properties/AssemblyInfo.cs @@ -34,5 +34,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("1.5.1.0")] -[assembly: AssemblyFileVersion("1.5.1.0")] +[assembly: AssemblyVersion("1.6.1.0")] +[assembly: AssemblyFileVersion("1.6.1.0")] diff --git a/src/Brutal.Dev.StrongNameSigner/Properties/AssemblyInfo.cs b/src/Brutal.Dev.StrongNameSigner/Properties/AssemblyInfo.cs index bfcdfc0..183b1bd 100644 --- a/src/Brutal.Dev.StrongNameSigner/Properties/AssemblyInfo.cs +++ b/src/Brutal.Dev.StrongNameSigner/Properties/AssemblyInfo.cs @@ -34,5 +34,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("1.5.1.0")] -[assembly: AssemblyFileVersion("1.5.1.0")] +[assembly: AssemblyVersion("1.6.1.0")] +[assembly: AssemblyFileVersion("1.6.1.0")]