Skip to content
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

Produce an MSBuild error when Git is not present in PATH #779

Closed
adamralph opened this issue Jul 9, 2022 · 2 comments · Fixed by #784
Closed

Produce an MSBuild error when Git is not present in PATH #779

adamralph opened this issue Jul 9, 2022 · 2 comments · Fixed by #784
Labels
enhancement New feature or request
Milestone

Comments

@adamralph
Copy link
Owner

adamralph commented Jul 9, 2022

Use case(s)

Diagnosing the case when "git" is not present in PATH.

Description

When "git" is not present in PATH, the following type of message is shown in an IDE:

image

The underlying problem is only visible in the build log:

1>Unhandled exception. System.InvalidOperationException: "git" is not present in PATH.
1> ---> System.ComponentModel.Win32Exception (2): An error occurred trying to start process 'git' with working directory 'Y:\adamralph\simple-exec\SimpleExec'. The system cannot find the file specified.
1>   at System.Diagnostics.Process.StartWithCreateProcess(ProcessStartInfo startInfo)
1>   at System.Diagnostics.Process.Start()
1>   at MinVer.Lib.GitCommand.TryRun(String args, String workingDirectory, ILogger log, String& output) in /_/MinVer.Lib/GitCommand.cs:line 32
1>   --- End of inner exception stack trace ---
1>   at MinVer.Lib.GitCommand.TryRun(String args, String workingDirectory, ILogger log, String& output) in /_/MinVer.Lib/GitCommand.cs:line 36
1>   at MinVer.Lib.Versioner.GetVersion(String workDir, String tagPrefix, String defaultPreReleasePhase, ILogger log) in /_/MinVer.Lib/Versioner.cs:line 38
1>   at MinVer.Lib.Versioner.GetVersion(String workDir, String tagPrefix, MajorMinor minMajorMinor, String buildMeta, VersionPart autoIncrement, String defaultPreReleasePhase, ILogger log, Boolean ignoreHeight) in /_/MinVer.Lib/Versioner.cs:line 18
1>   at MinVer.Program.<>c__DisplayClass1_0.<Main>b__0() in /_/minver-cli/Program.cs:line 81
1>   at McMaster.Extensions.CommandLineUtils.CommandLineApplication.<>c__DisplayClass143_0.<OnExecute>b__0(CancellationToken _)
1>   at McMaster.Extensions.CommandLineUtils.CommandLineApplication.ExecuteAsync(String[] args, CancellationToken cancellationToken)
1>   at McMaster.Extensions.CommandLineUtils.CommandLineApplication.Execute(String[] args)
1>   at MinVer.Program.Main(String[] args) in /_/minver-cli/Program.cs:line 88

With this enhancement, an MSBuild error is produced when "git" is not present in PATH.

  • Error code: MINVER1007
  • Error message: "git" is not present in PATH

image

Alternatives

Keep things as they are and require users to look at the build log to determine that the underlying problem is that "git" is not present in PATH.

Additional context

Thanks to @marinusmaurice for making me aware of this potential enhancement in #776.

@adamralph adamralph added the enhancement New feature or request label Jul 9, 2022
@adamralph adamralph added this to the 4.2.0 milestone Jul 9, 2022
@adamralph adamralph mentioned this issue Jul 24, 2022
@adamralph
Copy link
Owner Author

adamralph commented Jul 24, 2022

released in 4.2.0-alpha.1 and 4.2.0-rc.1

@adamralph
Copy link
Owner Author

adamralph commented Jul 30, 2022

@marinusmaurice would you like to try out 4.2.0-rc.1 to see if it behaves in the desired way you described in #776?

@adamralph adamralph mentioned this issue Jul 30, 2022
11 tasks
@adamralph adamralph changed the title Produce an MSBuild error when "git" is not present in PATH Produce an MSBuild error when Git is not present in PATH Jul 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant