You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Thanks for this extremely useful package. Unfortunately in my case, when I try to build code not yet in a git repository, I do not get the $GitIsDirty$ replacement working.
After some investigation, the internally called "git diff-index --quiet HEAD" command invoked from MSBUILD on my system returns exit code 128 instead of 1, which the project's MSBUILD script expects in order to detect compiling code from a git repository or not.
C:\Temp>git diff-index --quiet HEAD
fatal: not a git repository (or any of the parent directories): .git
C:\Temp>echo %errorlevel%
128
My temporary fix was changing the following code in GitInfo.targets from:
<!-- no git repository -->
<_ThisAssemblyContent Condition="'$(Language)' == 'C#' And '$(GitRoot)' == ''">$(_ThisAssemblyContent.Replace('$GitIsDirty$', 'false'))</_ThisAssemblyContent>
<_ThisAssemblyContent Condition="'$(Language)' == 'C#' And '$(GitIsDirty)' == '1'">$(_ThisAssemblyContent.Replace('$GitIsDirty$', 'true'))</_ThisAssemblyContent>
<_ThisAssemblyContent Condition="'$(Language)' == 'C#' And '$(GitIsDirty)' == '0'">$(_ThisAssemblyContent.Replace('$GitIsDirty$', 'false'))</_ThisAssemblyContent>
<!-- no git repository -->
<_ThisAssemblyContent Condition="'$(Language)' == 'VB' And '$(GitRoot)' == ''">$(_ThisAssemblyContent.Replace('$GitIsDirty$', 'False'))</_ThisAssemblyContent>
<_ThisAssemblyContent Condition="'$(Language)' == 'VB' And '$(GitIsDirty)' == '1'">$(_ThisAssemblyContent.Replace('$GitIsDirty$', 'True'))</_ThisAssemblyContent>
<_ThisAssemblyContent Condition="'$(Language)' == 'VB' And '$(GitIsDirty)' == '0'">$(_ThisAssemblyContent.Replace('$GitIsDirty$', 'False'))</_ThisAssemblyContent>
To:
<!-- no git repository -->
<_ThisAssemblyContent Condition="'$(Language)' == 'C#' And '$(GitRoot)' == ''">$(_ThisAssemblyContent.Replace('$GitIsDirty$', 'false'))</_ThisAssemblyContent>
<_ThisAssemblyContent Condition="'$(Language)' == 'C#' And '$(GitIsDirty)' != '0'">$(_ThisAssemblyContent.Replace('$GitIsDirty$', 'true'))</_ThisAssemblyContent>
<_ThisAssemblyContent Condition="'$(Language)' == 'C#' And '$(GitIsDirty)' == '0'">$(_ThisAssemblyContent.Replace('$GitIsDirty$', 'false'))</_ThisAssemblyContent>
<!-- no git repository -->
<_ThisAssemblyContent Condition="'$(Language)' == 'VB' And '$(GitRoot)' == ''">$(_ThisAssemblyContent.Replace('$GitIsDirty$', 'False'))</_ThisAssemblyContent>
<_ThisAssemblyContent Condition="'$(Language)' == 'VB' And '$(GitIsDirty)' != '0'">$(_ThisAssemblyContent.Replace('$GitIsDirty$', 'True'))</_ThisAssemblyContent>
<_ThisAssemblyContent Condition="'$(Language)' == 'VB' And '$(GitIsDirty)' == '0'">$(_ThisAssemblyContent.Replace('$GitIsDirty$', 'False'))</_ThisAssemblyContent>
This will work with any non-zero exit code from git.exe. Maybe it would be worth reviewing?
Thanks.
The text was updated successfully, but these errors were encountered:
Thanks for this extremely useful package. Unfortunately in my case, when I try to build code not yet in a git repository, I do not get the$GitIsDirty$ replacement working.
After some investigation, the internally called "git diff-index --quiet HEAD" command invoked from MSBUILD on my system returns exit code 128 instead of 1, which the project's MSBUILD script expects in order to detect compiling code from a git repository or not.
My temporary fix was changing the following code in GitInfo.targets from:
To:
This will work with any non-zero exit code from git.exe. Maybe it would be worth reviewing?
Thanks.
The text was updated successfully, but these errors were encountered: