-
Notifications
You must be signed in to change notification settings - Fork 663
Description
Describe the bug
dotnet pack will fail with a DirectoryNotFoundException when building a project that includes GitVersion.MsBuild and where IsPackable=false.
Expected Behavior
dotnet pack should succeed as if GitVersion.MsBuild was not there.
Actual Behavior
dotnet pack fails because GitVersion does not generate the GitVersionInformation.g.cs file:
C:\Users\cdonnelly\.nuget\packages\gitversion.msbuild\5.6.11\tools\GitVersion.MsBuild.targets(110,9): error : DirectoryNotFoundException: Could not find a part of the path 'D:\temp\marklar\obj\Debug\GitVersionInformation.g.cs'. [D:\temp\marklar\marklar.csproj]
Steps to Reproduce
- Clone https://github.com/cdonnellytx/GitVersionPackBug
- Run
dotnet pack
Context
We are hitting this in a solution which contains a large number of NuGet packages and also includes their test projects, and in which we are importing GitVersion.MsBuild into all in a Directory.Build.props file.
The good news is I can easily work around this by adding an IsPackable check to my Include. The ideal path may be to just short-circuit out if IsPackable is false, but I don't know how this would affect a project with both NuGet and non-NuGet deployable packages that need versioning.
Your Environment
- Windows 10 x64, Version 21H1 (OS Build 19043.1165)
- .NET SDK 5.0.400 (x64)
- GitVersion 5.6.11
- Link to your project: https://github.com/cdonnellytx/GitVersionPackBug
- Link to your CI build (if appropriate): The actual project and CI build are on an internal company GitHub Enterprise instance; the sample project replicates the bug in a much more minimalist fashion.