GitVersion: [Bug] GitVersion.MsBuild produces extra files

Describe the bug GitVersion.MsBuild produces files called gitversion.json in each project directory. Thus, a .gitignore entry is in order for those using this, which is a little annoying. GitVersionTask did not have this issue.

For context, I am using Paket, so I do a paket restore before building with msbuild.

Expected Behavior

Run a build and have no unexpected side-effects.

Actual Behavior

Ran a build and got several files showing up as changes in git.

Context

I am wanting to upgrade from the deprecated GitVersionTask to the more up-to-date GitVersion.MsBuild so that the version of it can keep up with the executable distribution, to help isolate build issues.

Your Environment

OS: Windows 10 Project Target: net462 Visual Studio Version: 2019 16.8.4 Paket Version: 5.257.0 GitVersion.MsBuild Version: 5.6.4

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 19 (7 by maintainers)

Most upvoted comments

I had the same problem, I change the order of the GitVersion.MsBuild.props’s import in my csproj.

So I put the line : <Import Project="packages\GitVersion.MsBuild.5.6.6\build\GitVersion.MsBuild.props" Condition="Exists('packages\GitVersion.MsBuild.5.6.6\build\GitVersion.MsBuild.props')" /> After the line : <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />

Now, the gitversion.json is produced in the obj folder for my project.