Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
17 changes: 17 additions & 0 deletions .github/workflows/dotnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,23 @@ jobs:
id: gitversion
uses: gittools/actions/gitversion/execute@v4

# Export GitVersion outputs as env vars. MSBuild auto-binds env vars whose name
# matches a property to a global property, so every subsequent dotnet build/publish/
# pack/test in this job — including ones launched by TUnit.Pipeline — stamps the
# correct AssemblyVersion/FileVersion even on AOT recompiles. Without this, a
# publish that triggers a recompile drops AssemblyVersion to 1.0.0.0, and any
# following `pack --no-build` ships a strong-name-mismatched package (issue #5622).
- name: Export version env vars
shell: bash
run: |
{
echo "Version=${{ steps.gitversion.outputs.semVer }}"
echo "AssemblyVersion=${{ steps.gitversion.outputs.assemblySemVer }}"
echo "FileVersion=${{ steps.gitversion.outputs.assemblySemFileVer }}"
echo "InformationalVersion=${{ steps.gitversion.outputs.informationalVersion }}"
echo "PackageVersion=${{ steps.gitversion.outputs.fullSemVer }}"
} >> "$GITHUB_ENV"
- name: Restore
shell: bash
run: dotnet restore TUnit.CI.slnx
Expand Down
6 changes: 6 additions & 0 deletions TUnit.Pipeline/Modules/PackTUnitFilesModule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,14 @@

namespace TUnit.Pipeline.Modules;

// Must run after any module that may recompile packable projects (TUnit.Mocks et al).
// This module uses NoBuild=true and packs whatever bin/Release/{tfm}/*.dll is on disk, so
// a racing recompile without version props would ship strong-name-mismatched packages.
// Version props come from $GITHUB_ENV (see .github/workflows/dotnet.yml) so recompiles
// also stamp the correct AssemblyVersion. See issue #5622.
[DependsOn<GetPackageProjectsModule>]
[DependsOn<GenerateVersionModule>]
[DependsOn<PublishMockTestsAOTModule>]
public class PackTUnitFilesModule : Module<List<PackedProject>>
{
// Packages in beta get a "-beta" suffix appended to their version.
Expand Down
2 changes: 1 addition & 1 deletion TUnit.Pipeline/Modules/PublishNugetTesterAOTModule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ protected override ModuleConfiguration Configure() => ModuleConfiguration.Create
Properties =
[
new KeyValue("Aot", "true"),
new KeyValue("TUnitVersion", version.ValueOrDefault!.SemVer!)
new KeyValue("TUnitVersion", version.ValueOrDefault!.SemVer!),
],
Framework = framework,
}, new CommandExecutionOptions
Expand Down
Loading