private AssemblyInfo SignSingleAssembly(string assemblyPath, string keyPath, string outputDirectory, params string[] probingPaths) { try { Log.LogMessage(MessageImportance.Low, string.Empty); Log.LogMessage(MessageImportance.Low, "Strong-name signing '{0}'...", assemblyPath); var oldInfo = SigningHelper.GetAssemblyInfo(assemblyPath); var newInfo = SigningHelper.SignAssembly(assemblyPath, keyPath, outputDirectory, null, probingPaths); if (!oldInfo.IsSigned && newInfo.IsSigned) { Log.LogMessage(MessageImportance.Normal, "'{0}' was strong-name signed successfully.", newInfo.FilePath); return(newInfo); } else { Log.LogMessage(MessageImportance.Low, "'{0}' already strong-name signed...", assemblyPath); } } catch (BadImageFormatException bife) { Log.LogWarningFromException(bife, true); } catch (Exception ex) { Log.LogErrorFromException(ex, true, true, null); } return(null); }
private AssemblyInfo SignSingleAssembly(string assemblyPath, string keyPath, string outputDirectory, params string[] probingPaths) { try { Log.LogMessage(MessageImportance.Low, string.Empty); Log.LogMessage(MessageImportance.Low, "Strong-name signing '{0}'...", assemblyPath); var oldInfo = SigningHelper.GetAssemblyInfo(assemblyPath); var newInfo = SigningHelper.SignAssembly(assemblyPath, keyPath, outputDirectory, null, probingPaths); if (!oldInfo.IsSigned && newInfo.IsSigned) { Log.LogMessage(MessageImportance.High, "Strong-name signature applied to '{0}' successfully.", newInfo.FilePath); return(newInfo); } else { Log.LogMessage(MessageImportance.Low, "Strong-name signature already applied to '{0}'...", assemblyPath); Log.LogMessage(MessageImportance.Low, "Original assembly IsSigned: {0}, After signing attempt IsSigned: {1}", oldInfo.IsSigned.ToString(), newInfo.IsSigned.ToString()); } } catch (BadImageFormatException ex) { Log.LogWarningFromException(ex, true); } catch (IOException ex) { Log.LogWarningFromException(ex, false); } catch (Exception ex) { Log.LogErrorFromException(ex, true, true, assemblyPath); } return(null); }