diff --git a/src/Analyzer/GitInfoGenerator.cs b/src/Analyzer/GitInfoGenerator.cs
new file mode 100644
index 0000000..aa32c87
--- /dev/null
+++ b/src/Analyzer/GitInfoGenerator.cs
@@ -0,0 +1,40 @@
+using Microsoft.CodeAnalysis;
+
+[Generator(LanguageNames.CSharp)]
+class GitInfoGenerator : IIncrementalGenerator
+{
+ public void Initialize(IncrementalGeneratorInitializationContext context)
+ {
+ context.RegisterSourceOutput(
+ context.AdditionalTextsProvider
+ .Combine(context.AnalyzerConfigOptionsProvider)
+ .Combine(context.ParseOptionsProvider)
+ .Collect(),
+ (c, _) =>
+ {
+ c.AddSource("ThisAssembly.Git.IsDirty.g",
+ $$"""
+ //------------------------------------------------------------------------------
+ //
+ // This code was generated by a tool.
+ //
+ // GitInfo: {{ThisAssembly.Info.InformationalVersion}}
+ //
+ // Changes to this file may cause incorrect behavior and will be lost if
+ // the code is regenerated.
+ //
+ //------------------------------------------------------------------------------
+ partial class ThisAssembly
+ {
+ partial class Git
+ {
+ ///
+ /// Gets whether the current repository is dirty.
+ ///
+ public static bool IsDirty => bool.TryParse(IsDirtyString, out var dirty) && dirty;
+ }
+ }
+ """);
+ });
+ }
+}
\ No newline at end of file
diff --git a/src/GitInfo/build/GitInfo.ThisAssembly.targets b/src/GitInfo/build/GitInfo.ThisAssembly.targets
index 9d9f774..4cb585b 100644
--- a/src/GitInfo/build/GitInfo.ThisAssembly.targets
+++ b/src/GitInfo/build/GitInfo.ThisAssembly.targets
@@ -37,7 +37,6 @@
BeforeTargets="PrepareConstants" Condition="'$(GitThisAssembly)' == 'true'">
-