diff --git a/Tools/VECTOStart/Program.cs b/Tools/VECTOStart/Program.cs index 424265b4c7c8d5e3740e6b6c04de55c61f913848..f99188e877fb616643ab4ba635ad8c05d3b542a9 100644 --- a/Tools/VECTOStart/Program.cs +++ b/Tools/VECTOStart/Program.cs @@ -4,28 +4,32 @@ using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; +using System.Windows.Forms; namespace TUGraz.VECTO { class Program { - static void Main(string[] args) - { + static void Main(string[] args) { + var path = "No path found."; + string version = "No version found."; try { - string version; if (args.Length > 0) { version = args[0]; ValidateVersion(version); } else { version = GetHighestNETVersion(); } - Process.Start(new ProcessStartInfo($"{version}\\{Assembly.GetExecutingAssembly().GetName().Name}.exe") { + + path = $"{version}\\{Assembly.GetExecutingAssembly().GetName().Name}.exe"; + Process.Start(new ProcessStartInfo(path) { WorkingDirectory = Directory.GetCurrentDirectory() }); } catch (Exception e) { Console.WriteLine(e); - File.AppendAllText("LOG.txt", e.ToString()); - throw; + var message = $"Error during starting VECTO.\nDetected .NET version: {version}\nTried to open path: {path}\n{e.Message}"; + File.AppendAllText("LOG.txt", $"{DateTime.Now} {message}\n"); + MessageBox.Show(message); } } diff --git a/Tools/VECTOStart/VECTOStart.csproj b/Tools/VECTOStart/VECTOStart.csproj index c4cdcdedd451f9f16406bf197f3157ce195d5910..176ff3fc47fc375c2433a24d2546b29532da300d 100644 --- a/Tools/VECTOStart/VECTOStart.csproj +++ b/Tools/VECTOStart/VECTOStart.csproj @@ -10,4 +10,8 @@ <DefineConstants /> </PropertyGroup> + <ItemGroup> + <Reference Include="System.Windows.Forms" /> + </ItemGroup> + </Project>