-
Notifications
You must be signed in to change notification settings - Fork 664
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
| <PropertyGroup Condition="'$(MSBuildRuntimeType)' == 'Full' Or '$(MSBuildRuntimeType)' == 'Mono'"> | |
| <GitVersionFileExe>$(MSBuildThisFileDirectory)net48/gitversion.exe</GitVersionFileExe> | |
| <GitVersionAssemblyFile>$(MSBuildThisFileDirectory)net48/GitVersion.MsBuild.dll</GitVersionAssemblyFile> | |
| </PropertyGroup> | |
| <PropertyGroup Condition="'$(TargetFramework)' == 'netcoreapp3.1'"> | |
| <GitVersionFileExe>dotnet $(MSBuildThisFileDirectory)netcoreapp3.1/gitversion.dll</GitVersionFileExe> | |
| <GitVersionAssemblyFile>$(MSBuildThisFileDirectory)netcoreapp3.1/GitVersion.MsBuild.dll</GitVersionAssemblyFile> | |
| </PropertyGroup> | |
| <PropertyGroup Condition="'$(TargetFramework)' == 'net5.0'"> | |
| <GitVersionFileExe>dotnet $(MSBuildThisFileDirectory)net5.0/gitversion.dll</GitVersionFileExe> | |
| <GitVersionAssemblyFile>$(MSBuildThisFileDirectory)net5.0/GitVersion.MsBuild.dll</GitVersionAssemblyFile> | |
| </PropertyGroup> |
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.