Skip to content

Commit

Permalink
Show useful error message and directions to users lacking requirement…
Browse files Browse the repository at this point in the history
…s for Stride.Core.Tasks
  • Loading branch information
Eideren committed Sep 17, 2023
1 parent 896eedb commit 206d77a
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion sources/core/Stride.Core.Tasks/Program.cs
Original file line number Diff line number Diff line change
@@ -16,7 +16,20 @@ static class Program
{
public static int Main(string[] args)
{
MSBuildLocator.RegisterDefaults();
try
{
MSBuildLocator.RegisterDefaults();
}
catch (InvalidOperationException e) when (e.Message.StartsWith("No instances of MSBuild could be detected."))
{
// When tasks running through build tools throw, it logs an obtuse 'The command [...]/Stride.Core.Tasks.exe [...] exited with code - x'
// message requiring the user to dig in the output to figure out what happened.
// The following ensures that a clear message is logged before the stuff above is shown.
// Do note that the 'error' word in the message is essential for it to be logged,
// direct any message about this peculiar 'feature' over to Microsoft, thanks !
Console.Error.WriteLine($@"error {typeof(Program).Namespace}: No supported instance of MSBuild could be detected, make sure you have .Net SDK {Environment.Version.Major} {Environment.Version.Minor} installed");
throw;
}
return RealMain(args);
}

0 comments on commit 206d77a

Please sign in to comment.