Make console opening Windows + Debug only

This commit is contained in:
Matt Nadareski
2021-06-29 13:49:37 -07:00
parent 258b3e9fee
commit ef7cdcb2e1
2 changed files with 8 additions and 12 deletions

View File

@@ -1,4 +1,4 @@
#if Windows
#if WindowsDebug
using System.Runtime.InteropServices;
#endif
using Avalonia;
@@ -10,17 +10,17 @@ namespace RedBookPlayer
{
public static void Main(string[] args)
{
#if Windows
#if WindowsDebug
AllocConsole();
#endif
#endif
BuildAvaloniaApp().StartWithClassicDesktopLifetime(args);
}
#if Windows
#if WindowsDebug
[DllImport("kernel32.dll", SetLastError = true)]
[return: MarshalAs(UnmanagedType.Bool)]
static extern bool AllocConsole();
#endif
#endif
public static AppBuilder BuildAvaloniaApp() => AppBuilder.Configure<App>().UsePlatformDetect().LogToDebug();
}

View File

@@ -1,17 +1,13 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<RuntimeIdentifiers>win-x64;linux-x64</RuntimeIdentifiers>
<RuntimeIdentifier>linux-x64</RuntimeIdentifier>
<DebugType>embedded</DebugType>
<PublishSingleFile>true</PublishSingleFile>
<SelfContained>true</SelfContained>
<PublishTrimmed>true</PublishTrimmed>
</PropertyGroup>
<PropertyGroup Condition="'$(RuntimeIdentifier)' == 'win-x64'">
<DefineConstants>Windows</DefineConstants>
<PropertyGroup Condition="'$(RuntimeIdentifier)' == 'win-x64' AND '$(Configuration)' == 'Debug'">
<DefineConstants>WindowsDebug</DefineConstants>
</PropertyGroup>
<ItemGroup>
<Compile Update="**\*.xaml.cs">