From 29463eb83402e2e8834b35bf8214a39a2eb846bc Mon Sep 17 00:00:00 2001 From: Colin McMillen Date: Thu, 22 Jul 2021 11:14:46 -0400 Subject: [PATCH] make DesktopGL build work with "dotnet run" --- DesktopGL/DesktopGL.csproj | 2 +- DesktopGL/DesktopGLProgram.cs | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/DesktopGL/DesktopGL.csproj b/DesktopGL/DesktopGL.csproj index 678f1e2..0692a05 100644 --- a/DesktopGL/DesktopGL.csproj +++ b/DesktopGL/DesktopGL.csproj @@ -1,6 +1,6 @@  - WinExe + Exe net5.0 false false diff --git a/DesktopGL/DesktopGLProgram.cs b/DesktopGL/DesktopGLProgram.cs index 410e500..2511500 100644 --- a/DesktopGL/DesktopGLProgram.cs +++ b/DesktopGL/DesktopGLProgram.cs @@ -1,5 +1,6 @@ using Microsoft.Xna.Framework; using System; +using System.IO; namespace SemiColinGames { @@ -38,6 +39,10 @@ namespace SemiColinGames { public static class DesktopGLProgram { [STAThread] static void Main() { + string path = System.Reflection.Assembly.GetEntryAssembly().Location; + path = System.IO.Path.GetDirectoryName(path); + Directory.SetCurrentDirectory(path); + using (var game = new SneakGame()) { game.Services.AddService(typeof(IDisplay), new DesktopGLDisplay()); game.Run();