Skip to content

[Bug] -output file -outputfile gitversion.json exited with code 1. #2993

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
ucapbba opened this issue Feb 12, 2022 · 8 comments
Closed

[Bug] -output file -outputfile gitversion.json exited with code 1. #2993

ucapbba opened this issue Feb 12, 2022 · 8 comments

Comments

@ucapbba
Copy link

ucapbba commented Feb 12, 2022

Description of issue

I have added GitVersion.MsBuild.5.8.1to my GUI.csproj (contained in a Visual Studio 2017 solution with many projects). My .yml contains the line run: msbuild /m /p:Configuration=${{env.BUILD_CONFIGURATION}} ${{env.SOLUTION_FILE_PATH}}
which is run after push. Having added GitVersion I see (full paths reduced):

   "D:\a\GUI\GUI.csproj" (default target) (2) ->
   (RunGitVersion target) -> 
     D:\a\packages\GitVersion.MsBuild.5.8.1\tools\GitVersion.MsBuild.targets(9,9): error MSB3073: The command ""D:\a\packages\GitVersion.MsBuild.5.8.1\tools\net48/gitversion.exe" "D:\a\GUI" -output file -outputfile gitversion.json" exited with code 1. [D:\a\GUI\GUI.csproj]

Analysis

The line where error occurs in GitVersion.MsBuild.target is

Exec Command="$(GitVersionFileExe) "$(MSBuildProjectDirectory)" $(GitVersion_ToolArgments)"

I add my gitversion.json which appeared in my project folder after local build (I also tried adding to source control but I guess not required) , and my msbuild.yml and GUI.csproj used here:

gitversion - Copy.json.txt
msbuild - Copy.yml.txt
GUI - Copy.csproj.txt

Context

This is the first time I have used GitVersion. I installed using NuGet package and removed AssemblyInfo.cs from the .csproj. The repository is private, if useful I can add a user to assist.

I have been following here to try to understand the issue
https://gitversion.net/docs/usage/msbuild

Your Environment

VS 2017 / Net 4.8 / Windows 10 / GitVersion.MsBuild.5.8.1

Thankyou

@ucapbba ucapbba added the bug label Feb 12, 2022
@ucapbba ucapbba changed the title [Bug] [Bug] -output file -outputfile gitversion.json" exited with code 1. Feb 12, 2022
@ucapbba ucapbba changed the title [Bug] -output file -outputfile gitversion.json" exited with code 1. [Bug] -output file -outputfile gitversion.json exited with code 1. Feb 12, 2022
@asbjornu
Copy link
Member

Can you please try the command line instead? If it too fails, it may be easier to figure out why.

@ucapbba
Copy link
Author

ucapbba commented Feb 18, 2022

running dotnet-gitversion from my .git location I get
image
which looks reasonable.

I re-added my AssemblyInfo.cs and ran dotnet-gitversion /updateassemblyinfo and my AssemblyInfo.cs is updated with

[assembly: AssemblyInformationalVersion("0.1.0-FRAN-90-Jenkins.1+314.Branch.FRAN-90-Jenkins.Sha.e09f43344ed471e1ae810288e0527a946f86383c")]

I then ran the line from the build error in command line
Path\packages\GitVersion.MsBuild.5.8.1\tools\net48/gitversion.exe Path\GUI -output file -outputfile gitversion.json
and do not receive any error so it seems to be something to do with the msbuild.yml

@asbjornu
Copy link
Member

Yeah, looks like GitVersion itself is working fine. If there's something wrong with msbuild.yml, that's out of scope for GitVersion, sorry.

@ucapbba
Copy link
Author

ucapbba commented Feb 19, 2022

Perhaps it's related to this case :
#2534

the slash seems to be the wrong way before gitversion.exe \net48/gitversion.exe so perhaps the error is due to not being able to find GitVersion.exe in the GitAction

@ucapbba
Copy link
Author

ucapbba commented Feb 19, 2022

I have replicated the case with a very simple test project
https://github.com/ucapbba/CodeSamples/tree/main/GitAction
and workflow
https://github.com/ucapbba/CodeSamples/tree/main/.github/workflows

It is the default "Hello World" .csproj in visual studio which uses the default MSBuild git action from GitHub and uses the GitVersion.MSBuild NuGet Package. You can see exactly what has been done and replicate the error with a push to main or PR to GitVersion branch

@asbjornu
Copy link
Member

asbjornu commented Mar 3, 2022

@ucapbba, for GitVersion to execute successfully, it needs the full repository history. By default, actions/checkout does a shallow clone. Add the following to the workflow and it should at least be able to execute:

    - uses: actions/checkout@v2
      with:
        fetch-depth: 0

This requirement is documented.

ucapbba added a commit to ucapbba/CodeSamples that referenced this issue Mar 4, 2022
@github-actions
Copy link

github-actions bot commented Apr 4, 2023

This issue has been automatically marked as stale because it has not had recent activity. After 30 days from now, it will be closed if no further activity occurs.

@github-actions github-actions bot added the stale label Apr 4, 2023
@github-actions
Copy link

github-actions bot commented May 5, 2023

This issue was closed because it has been stalled for 30 days with no activity. Thank you for your contributions

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale May 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants