Skip to content

Fix: Avoid assembly loading in MSBuild task#25

Merged
stephanprobst merged 2 commits intomainfrom
fix/msbuild-task-assembly-loading
Jan 11, 2026
Merged

Fix: Avoid assembly loading in MSBuild task#25
stephanprobst merged 2 commits intomainfrom
fix/msbuild-task-assembly-loading

Conversation

@stephanprobst
Copy link
Owner

Summary

  • Fix GenerateVersionFileTask to parse generated source files instead of loading the compiled assembly
  • This prevents crashes with frameworks like TUnit that use module initializers
  • Enable EmitCompilerGeneratedFiles to write generated sources to disk
  • Use regex to extract version constants from AppVersion.g.cs
  • No external dependencies required (removed bundled System.Reflection.Metadata DLLs)

Replace Assembly.Load() with text-based parsing of generated source files.
This prevents issues with frameworks like TUnit that use module initializers.

- Enable EmitCompilerGeneratedFiles to write generated sources to disk
- Parse AppVersion.g.cs with regex instead of loading the assembly
- No external dependencies required (removed bundled DLLs)
No longer needed since MSBuild task reads AppVersion.g.cs directly.
@stephanprobst stephanprobst merged commit e3e362a into main Jan 11, 2026
4 checks passed
@stephanprobst stephanprobst deleted the fix/msbuild-task-assembly-loading branch January 11, 2026 15:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant