Skip to content

Commit

Permalink
Merge pull request brutaldev#63 from smklancher/master
Browse files Browse the repository at this point in the history
Fixes brutaldev#62 NullReferenceException when using ReferenceAssemblyAnnotator
  • Loading branch information
brutaldev authored May 10, 2021
2 parents ee0e490 + c66019d commit 1e5b1b8
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2013/05/nuspec.xsd">
<metadata>
<id>Brutal.Dev.StrongNameSigner</id>
<version>2.7.1</version>
<version>2.7.2</version>
<title>.NET Assembly Strong-Name Signer</title>
<authors>Werner van Deventer</authors>
<owners>Werner van Deventer</owners>
Expand Down
8 changes: 6 additions & 2 deletions src/Brutal.Dev.StrongNameSigner/AutomaticBuildTask.cs
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,13 @@ public override bool Execute()
if (!signedAssembly.IsSigned)
{
signedAssembly = SignSingleAssembly(References[i].ItemSpec, snkFilePath, signedAssemblyFolder, probingPaths);
chagesMade = true;
if(signedAssembly != null)
{
chagesMade = true;
}
}

if (signedAssembly.IsSigned)
if (signedAssembly != null && signedAssembly.IsSigned)
{
signedAssemblyPaths.Add(signedAssembly.FilePath);
processedAssemblyPaths.Add(signedAssembly.FilePath);
Expand Down Expand Up @@ -185,6 +188,7 @@ private AssemblyInfo SignSingleAssembly(string assemblyPath, string keyPath, str
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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,4 +104,12 @@
</PropertyGroup>
<Error Condition="!Exists('..\..\packages\StyleCop.MSBuild.6.1.0\build\StyleCop.MSBuild.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\StyleCop.MSBuild.6.1.0\build\StyleCop.MSBuild.targets'))" />
</Target>
<PropertyGroup>
<PostBuildEvent>REM requires installing nuget commandline. example using chocolatey:
REM choco install nuget.commandline
REM note: output dir cannot end in slash
if /I "$(ConfigurationName)" == "Release" nuget.exe pack $(ProjectDir)..\Brutal.Dev.StrongNameSigner.Setup\StrongNameSigner.nuspec -Properties "Configuration=$(Configuration)" -NonInteractive -OutputDirectory "$(ProjectDir)bin\$(ConfigurationName)

if /I "$(ConfigurationName)" == "Release" "$(SystemRoot)\Microsoft.NET\Framework\v4.0.30319\msbuild.exe" /p:CleanIntermediates=True /p:Configuration=Release "$(SolutionDir)Brutal.Dev.StrongNameSigner.Docs\Documentation.shfbproj"</PostBuildEvent>
</PropertyGroup>
</Project>

0 comments on commit 1e5b1b8

Please sign in to comment.