Skip to content

Conversation

@delatrie
Copy link
Contributor

@delatrie delatrie commented Sep 23, 2025

Context

The PR introduces strong names for assemblies of the following packages:

  • Allure.Net.Commons
  • Allure.NUnit
  • Allure.Reqnroll

Other packages can't use strong names because they rely on Lib.Harmony, which isn't strong-named. These are:

Since SpecFlow is already deprecated by Tricentis, it's unlikely we'll implement strong names for Allure.SpecFlow.

As for Allure.Xunit, it's currently incompatible with .NET Framework, which is an issue on its own (see #589) and should be addressed first. Then, once we find a replacement for harmony (#369), we can make Allure.Xunit strong-named.

Signing and AspectInjector

We use Aspect Injector to implement [AllureStep], [AllureBefore], [AllureAfter] and some other aspects. The way it works makes the assembly's signature invalid. Such a signature should then be updated with sn.exe, which is a part of the Visual Studio installation on Windows machines. Otherwise, loading the assembly on .NET Framework throws Could not load file or assembly '<assembly>' or one of its dependencies. Strong name signature could not be verified.

The PR updates the publishing workflow to run on Windows and to use vswhere.exe (which is a part of the windows-latest image) to locate the Visual Studio installation folder. It then uses the Developer PowerShell tool in that folder to locate sn.exe. The path to sn.exe is forwarded to an MSBuild target via the Allure_SnExePath property. The target runs after Aspect Injector changes the assembly. It updates the signature by calling sn.exe -Ra <assembly>. After that's done, the assembly passes the sn.exe -vf <assembly> check. The resigned assembly is uploaded to NuGet.

Resigning during development

This resigning routine isn't required during development because our test/sample projects target a modern .NET runtime (8.0 at the time), which doesn't verify strong names. If, for some reason, a developer needs valid signatures, they should set the Allure_SnExePath environment variable. Use ./build/findvstool.ps1 to find the correct path:

$Env:Allure_SnExePath = ./build/findvstool.ps1 sn.exe
dotnet build

Obviously, this only works (and makes sense) on Windows.

AspectInjector update

The PR updates AspectInjector to version 2.9.0, which runs natively on Apple Silicon. This makes the workaround added via #396 unnecessary, so the PR removes it as well.

Other changes

  • Fix publish.yml job name to be publish.
  • Set PackageReleaseNotes from publish.yml instead of Directory.Build.props.
  • Rename the build workflow to test.
  • Prefix all Allure-specific properties and target names with Allure_ in DirectoryBuild.targets to prevent collisions.

Closes #376
Closes #391

@darrenge
Copy link

Hey @delatrie any update \ ETA on when this PR will be pushed? Looking forward to it.

@delatrie
Copy link
Contributor Author

@darrenge very soon. There are some minor msbuild-related fixes left that need to be applied. Hopefully, it will be done in a day or two.

@delatrie delatrie force-pushed the strong-naming branch 3 times, most recently from 5df7cd0 to 46db7ad Compare October 6, 2025 14:17
@delatrie delatrie marked this pull request as ready for review October 7, 2025 07:52
@delatrie delatrie merged commit ad36023 into allure-framework:main Oct 7, 2025
2 of 6 checks passed
@delatrie delatrie deleted the strong-naming branch October 7, 2025 09:24
@darrenge
Copy link

darrenge commented Oct 7, 2025

@delatrie -- when will this be released in nuget package vs just being in code base? Thanks for taking care of it.

@delatrie
Copy link
Contributor Author

delatrie commented Oct 9, 2025

@darrenge will push it in a moment, sorry for the delay

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Failed local build project on Mac with Apple silicon using Allure.NUnit 2.10.0-preview.1 Sign assemblies with strong name.

3 participants