diff --git a/src/Nerdbank.GitVersioning.Tasks/build/Nerdbank.GitVersioning.targets b/src/Nerdbank.GitVersioning.Tasks/build/Nerdbank.GitVersioning.targets index 4cba9f6f..0fa3bb88 100644 --- a/src/Nerdbank.GitVersioning.Tasks/build/Nerdbank.GitVersioning.targets +++ b/src/Nerdbank.GitVersioning.Tasks/build/Nerdbank.GitVersioning.targets @@ -8,6 +8,11 @@ $(VersionDependsOn) + + GetBuildVersion; + $(CleanDependsOn) + + GetBuildVersion; $(GenerateNuspecDependsOn) diff --git a/test/Nerdbank.GitVersioning.Tests/BuildIntegrationTests.cs b/test/Nerdbank.GitVersioning.Tests/BuildIntegrationTests.cs index de6b10b0..104a7439 100644 --- a/test/Nerdbank.GitVersioning.Tests/BuildIntegrationTests.cs +++ b/test/Nerdbank.GitVersioning.Tests/BuildIntegrationTests.cs @@ -131,6 +131,14 @@ public async Task GetBuildVersion_Without_Git() Assert.Equal("3.4.0", buildResult.AssemblyInformationalVersion); } + [Fact] + public async Task GetBuildVersion_Hooks_Clean() + { + this.WriteVersionFile("1.2"); + BuildResults buildResult = await this.BuildAsync("Clean"); + Assert.Equal("1.2", buildResult.BuildVersion); + } + [Fact] public async Task GetBuildVersion_Without_Git_HighPrecisionAssemblyVersion() {