Closed
Description
Describe the Bug
ThisAssembly.Git produces a build error when solution has Git submodules
ThisAssembly.Git.targets(71,7): error MSB4184: The expression "[System.IO.File]::ReadAllText(/path/;/path/anotherpath/.git/HEAD)" cannot be evaluated. Could not find a part of the path '/path/;/path/anotherpath/.git/HEAD'
Issue is in ThisAssembly.Git.targets line 71 $([System.IO.File]::ReadAllText
<PropertyGroup Condition="'$(RepositoryBranch)' == '' and '$(RepositoryRoot)' != ''">
<!-- We may not be in CI at all. If we got a git repo root, we can directly read HEAD -->
<RepositoryHead>$(RepositoryRoot).git/HEAD</RepositoryHead>
<RepositoryBranch Condition="Exists($(RepositoryHead))">$([System.IO.File]::ReadAllText($(RepositoryHead)).Trim())</RepositoryBranch>
<RepositoryBranch Condition="$(RepositoryBranch) != ''">$(RepositoryBranch.TrimStart("ref:").Trim().TrimStart("refs").Trim("/").TrimStart("heads").Trim("/").Trim())</RepositoryBranch>
</PropertyGroup>
I believe because @(SourceRoot)
will also return submodule information