Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .github/workflows/dotnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,14 @@ jobs:

- name: Publish AOT
shell: bash
# BaseOutputPath/BaseIntermediateOutputPath isolate this AOT publish from the
# main bin/Release tree so PackTUnitFilesModule (--no-build) never packages a
# DLL rewritten by this step (issue #5622).
run: >-
dotnet publish TUnit.TestProject/TUnit.TestProject.csproj -c Release
--use-current-runtime -p:Aot=true -o TESTPROJECT_AOT --framework net10.0
-p:BaseOutputPath=bin/aot-testproject/
-p:BaseIntermediateOutputPath=obj/aot-testproject/
"-p:Version=${{ steps.gitversion.outputs.semVer }}"
"-p:AssemblyVersion=${{ steps.gitversion.outputs.assemblySemVer }}"
"-p:FileVersion=${{ steps.gitversion.outputs.assemblySemFileVer }}"
Expand Down
5 changes: 5 additions & 0 deletions TUnit.Pipeline/Modules/PackTUnitFilesModule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@

namespace TUnit.Pipeline.Modules;

// Runs concurrently with PublishMockTestsAOTModule / PublishNugetTesterAOTModule by design.
// Correctness depends on those modules using isolated BaseOutputPath/BaseIntermediateOutputPath
// so their recompiles never touch bin/Release/{tfm}/*.dll — this module uses NoBuild=true and
// packs whatever is on disk, so any rewrite of those DLLs (e.g. without -p:AssemblyVersion)
// would ship strong-name-mismatched packages. See issue #5622.
[DependsOn<GetPackageProjectsModule>]
[DependsOn<GenerateVersionModule>]
public class PackTUnitFilesModule : Module<List<PackedProject>>
Expand Down
8 changes: 8 additions & 0 deletions TUnit.Pipeline/Modules/PublishMockTestsAOTModule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,14 @@ protected override ModuleConfiguration Configure() => ModuleConfiguration.Create
Properties =
[
new KeyValue("Aot", "true"),
// Redirect build outputs into a per-framework tree so the AOT re-compile
// of ProjectReferences (TUnit.Mocks, TUnit.Mocks.Assertions) never
// overwrites the main bin/Release DLLs that PackTUnitFilesModule packages
// with --no-build. Without this, the re-compile drops AssemblyVersion back
// to 1.0.0.0 (CI passes AssemblyVersion only to the initial solution build),
// shipping strong-name-mismatched NuGet packages (issue #5622).
new KeyValue("BaseOutputPath", $"bin/aot-{framework}/"),
new KeyValue("BaseIntermediateOutputPath", $"obj/aot-{framework}/"),
],
Framework = framework,
}, new CommandExecutionOptions
Expand Down
6 changes: 5 additions & 1 deletion TUnit.Pipeline/Modules/PublishNugetTesterAOTModule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,11 @@ protected override ModuleConfiguration Configure() => ModuleConfiguration.Create
Properties =
[
new KeyValue("Aot", "true"),
new KeyValue("TUnitVersion", version.ValueOrDefault!.SemVer!)
new KeyValue("TUnitVersion", version.ValueOrDefault!.SemVer!),
// Isolate AOT publish outputs from the main bin/Release so packable
// projects' DLLs are never rewritten by this publish (issue #5622).
new KeyValue("BaseOutputPath", $"bin/aot-{framework}/"),
new KeyValue("BaseIntermediateOutputPath", $"obj/aot-{framework}/"),
],
Framework = framework,
}, new CommandExecutionOptions
Expand Down
Loading