Description
Because GitVersionTask seems to be deprecated, I have switched to the GitVersion.MsBuild package. However, the build of my netstandard2.1 library fails with the message
C:\Users\Thomas.nuget\packages\gitversion.msbuild\5.6.1\tools\GitVersion.MsBuild.targets(3,38): error MSB4022: The result "" of evaluating the value "$(GitVersionAssemblyFile)" of the "AssemblyFile" attribute in element is not valid. [C:\priv\GitVersionMsBuildIssue\src\DemoLib\DemoLib.csproj]
I have noticed that in GitVersion.MsBuild.props
, GitVersionFileExe
and GitVersionAssemblyFile
are not set when the target framework is netstandard2.1. See
I've fixed it on my local machine by adding following fallback:
<PropertyGroup Condition="'$(GitVersionFileExe)' == ''">
<GitVersionFileExe>dotnet $(MSBuildThisFileDirectory)netcoreapp3.1/gitversion.dll</GitVersionFileExe>
<GitVersionAssemblyFile>$(MSBuildThisFileDirectory)netcoreapp3.1/GitVersion.MsBuild.dll</GitVersionAssemblyFile>
</PropertyGroup>
I have created a repo to reproduce the issue at https://github.com/thoemmi/GitVersionMsBuildIssue
This fixed the build. However, on every build a gitversion.json file is generated in each project folder, which is really annoying. Is there another MsBuild property required to supress that?
Regarding the deprecation of GitVersionTask: The documentation for MSBuild Task still mentions the GitVersionTask package.