Browse Source

Use msbuild property

pull/7558/head
Steven He 5 years ago
parent
commit
89c9411527
  1. 27
      Avalonia.sln
  2. 33
      samples/ControlCatalog.NetCore.Native/ControlCatalog.NetCore.Native.csproj
  3. 132
      samples/ControlCatalog.NetCore.Native/Program.cs
  4. 14
      samples/ControlCatalog.NetCore/ControlCatalog.NetCore.csproj
  5. 0
      samples/ControlCatalog.NetCore/rd.xml

27
Avalonia.sln

@ -234,8 +234,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ControlSamples", "samples\S
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Avalonia.PlatformSupport", "src\Avalonia.PlatformSupport\Avalonia.PlatformSupport.csproj", "{E8A597F0-2AB5-4BDA-A235-41162DAF53CF}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ControlCatalog.NetCore.Native", "samples\ControlCatalog.NetCore.Native\ControlCatalog.NetCore.Native.csproj", "{C865FE0E-88C0-4026-8AC6-97FAB8C0AC90}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Ad-Hoc|Any CPU = Ad-Hoc|Any CPU
@ -2186,30 +2184,6 @@ Global
{E8A597F0-2AB5-4BDA-A235-41162DAF53CF}.Release|iPhone.Build.0 = Release|Any CPU
{E8A597F0-2AB5-4BDA-A235-41162DAF53CF}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
{E8A597F0-2AB5-4BDA-A235-41162DAF53CF}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
{C865FE0E-88C0-4026-8AC6-97FAB8C0AC90}.Ad-Hoc|Any CPU.ActiveCfg = Debug|Any CPU
{C865FE0E-88C0-4026-8AC6-97FAB8C0AC90}.Ad-Hoc|Any CPU.Build.0 = Debug|Any CPU
{C865FE0E-88C0-4026-8AC6-97FAB8C0AC90}.Ad-Hoc|iPhone.ActiveCfg = Debug|Any CPU
{C865FE0E-88C0-4026-8AC6-97FAB8C0AC90}.Ad-Hoc|iPhone.Build.0 = Debug|Any CPU
{C865FE0E-88C0-4026-8AC6-97FAB8C0AC90}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Debug|Any CPU
{C865FE0E-88C0-4026-8AC6-97FAB8C0AC90}.Ad-Hoc|iPhoneSimulator.Build.0 = Debug|Any CPU
{C865FE0E-88C0-4026-8AC6-97FAB8C0AC90}.AppStore|Any CPU.ActiveCfg = Debug|Any CPU
{C865FE0E-88C0-4026-8AC6-97FAB8C0AC90}.AppStore|Any CPU.Build.0 = Debug|Any CPU
{C865FE0E-88C0-4026-8AC6-97FAB8C0AC90}.AppStore|iPhone.ActiveCfg = Debug|Any CPU
{C865FE0E-88C0-4026-8AC6-97FAB8C0AC90}.AppStore|iPhone.Build.0 = Debug|Any CPU
{C865FE0E-88C0-4026-8AC6-97FAB8C0AC90}.AppStore|iPhoneSimulator.ActiveCfg = Debug|Any CPU
{C865FE0E-88C0-4026-8AC6-97FAB8C0AC90}.AppStore|iPhoneSimulator.Build.0 = Debug|Any CPU
{C865FE0E-88C0-4026-8AC6-97FAB8C0AC90}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C865FE0E-88C0-4026-8AC6-97FAB8C0AC90}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C865FE0E-88C0-4026-8AC6-97FAB8C0AC90}.Debug|iPhone.ActiveCfg = Debug|Any CPU
{C865FE0E-88C0-4026-8AC6-97FAB8C0AC90}.Debug|iPhone.Build.0 = Debug|Any CPU
{C865FE0E-88C0-4026-8AC6-97FAB8C0AC90}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
{C865FE0E-88C0-4026-8AC6-97FAB8C0AC90}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
{C865FE0E-88C0-4026-8AC6-97FAB8C0AC90}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C865FE0E-88C0-4026-8AC6-97FAB8C0AC90}.Release|Any CPU.Build.0 = Release|Any CPU
{C865FE0E-88C0-4026-8AC6-97FAB8C0AC90}.Release|iPhone.ActiveCfg = Release|Any CPU
{C865FE0E-88C0-4026-8AC6-97FAB8C0AC90}.Release|iPhone.Build.0 = Release|Any CPU
{C865FE0E-88C0-4026-8AC6-97FAB8C0AC90}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
{C865FE0E-88C0-4026-8AC6-97FAB8C0AC90}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@ -2271,7 +2245,6 @@ Global
{C08E9894-AA92-426E-BF56-033E262CAD3E} = {9B9E3891-2366-4253-A952-D08BCEB71098}
{26A98DA1-D89D-4A95-8152-349F404DA2E2} = {A0CC0258-D18C-4AB3-854F-7101680FC3F9}
{A0D0A6A4-5C72-4ADA-9B27-621C7D94F270} = {9B9E3891-2366-4253-A952-D08BCEB71098}
{C865FE0E-88C0-4026-8AC6-97FAB8C0AC90} = {9B9E3891-2366-4253-A952-D08BCEB71098}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {87366D66-1391-4D90-8999-95A620AD786A}

33
samples/ControlCatalog.NetCore.Native/ControlCatalog.NetCore.Native.csproj

@ -1,33 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<TargetLatestRuntimePatch>true</TargetLatestRuntimePatch>
<IlcTrimMetadata>true</IlcTrimMetadata>
<RestoreAdditionalProjectSources>https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet7/nuget/v3/index.json</RestoreAdditionalProjectSources>
<NativeAotCompilerVersion>7.0.0-*</NativeAotCompilerVersion>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\..\src\Avalonia.Headless.Vnc\Avalonia.Headless.Vnc.csproj" />
<ProjectReference Include="..\..\src\Avalonia.Dialogs\Avalonia.Dialogs.csproj" />
<ProjectReference Include="..\..\src\Linux\Avalonia.LinuxFramebuffer\Avalonia.LinuxFramebuffer.csproj" />
<ProjectReference Include="..\ControlCatalog\ControlCatalog.csproj" />
<ProjectReference Include="..\..\src\Avalonia.X11\Avalonia.X11.csproj" />
<PackageReference Include="Avalonia.Angle.Windows.Natives" Version="2.1.0.2020091801" />
<PackageReference Include="Microsoft.DotNet.ILCompiler" Version="$(NativeAotCompilerVersion)" />
<!-- Cross-compilation for Windows x64-arm64 and Linux x64-arm64 -->
<PackageReference Condition="'$(RuntimeIdentifier)'=='win-arm64'" Include="runtime.win-x64.Microsoft.DotNet.ILCompiler" Version="$(NativeAotCompilerVersion)" />
<PackageReference Condition="'$(RuntimeIdentifier)'=='linux-arm64'" Include="runtime.linux-x64.Microsoft.DotNet.ILCompiler" Version="$(NativeAotCompilerVersion)" />
<RdXmlFile Include="rd.xml" />
</ItemGroup>
<PropertyGroup>
<!-- For Microsoft.CodeAnalysis -->
<SatelliteResourceLanguages>en</SatelliteResourceLanguages>
</PropertyGroup>
<Import Project="..\..\build\SampleApp.props" />
<Import Project="..\..\build\ReferenceCoreLibraries.props" />
</Project>

132
samples/ControlCatalog.NetCore.Native/Program.cs

@ -1,132 +0,0 @@
using System;
using System.Diagnostics;
using System.Globalization;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Avalonia;
using Avalonia.Controls;
using Avalonia.Controls.ApplicationLifetimes;
using Avalonia.Headless;
using Avalonia.LogicalTree;
using Avalonia.Threading;
namespace ControlCatalog.NetCore.Native
{
static class Program
{
[STAThread]
static int Main(string[] args)
{
if (args.Contains("--wait-for-attach"))
{
Console.WriteLine("Attach debugger and use 'Set next statement'");
while (true)
{
Thread.Sleep(100);
if (Debugger.IsAttached)
break;
}
}
var builder = BuildAvaloniaApp();
double GetScaling()
{
var idx = Array.IndexOf(args, "--scaling");
if (idx != 0 && args.Length > idx + 1 &&
double.TryParse(args[idx + 1], NumberStyles.Any, CultureInfo.InvariantCulture, out var scaling))
return scaling;
return 1;
}
if (args.Contains("--fbdev"))
{
SilenceConsole();
return builder.StartLinuxFbDev(args, scaling: GetScaling());
}
else if (args.Contains("--vnc"))
{
return builder.StartWithHeadlessVncPlatform(null, 5901, args, ShutdownMode.OnMainWindowClose);
}
else if (args.Contains("--full-headless"))
{
return builder
.UseHeadless(true)
.AfterSetup(_ =>
{
DispatcherTimer.RunOnce(async () =>
{
var window = ((IClassicDesktopStyleApplicationLifetime)Application.Current.ApplicationLifetime)
.MainWindow;
var tc = window.GetLogicalDescendants().OfType<TabControl>().First();
foreach (var page in tc.Items.Cast<TabItem>().ToList())
{
// Skip DatePicker because of some layout bug in grid
if (page.Header.ToString() == "DatePicker")
continue;
Console.WriteLine("Selecting " + page.Header);
tc.SelectedItem = page;
await Task.Delay(500);
}
Console.WriteLine("Selecting the first page");
tc.SelectedItem = tc.Items.OfType<object>().First();
await Task.Delay(500);
Console.WriteLine("Clicked through all pages, triggering GC");
for (var c = 0; c < 3; c++)
{
GC.Collect(2, GCCollectionMode.Forced);
await Task.Delay(500);
}
void FormatMem(string metric, long bytes)
{
Console.WriteLine(metric + ": " + bytes / 1024 / 1024 + "MB");
}
FormatMem("GC allocated bytes", GC.GetTotalMemory(true));
FormatMem("WorkingSet64", Process.GetCurrentProcess().WorkingSet64);
}, TimeSpan.FromSeconds(1));
})
.StartWithClassicDesktopLifetime(args);
}
else if (args.Contains("--drm"))
{
SilenceConsole();
return builder.StartLinuxDrm(args, scaling: GetScaling());
}
else
return builder.StartWithClassicDesktopLifetime(args);
}
/// <summary>
/// This method is needed for IDE previewer infrastructure
/// </summary>
public static AppBuilder BuildAvaloniaApp()
=> AppBuilder.Configure<App>()
.UsePlatformDetect()
.With(new X11PlatformOptions
{
EnableMultiTouch = true,
UseDBusMenu = true,
EnableIme = true,
})
.With(new Win32PlatformOptions
{
EnableMultitouch = true
})
.UseSkia()
.LogToTrace();
static void SilenceConsole()
{
new Thread(() =>
{
Console.CursorVisible = false;
while (true)
Console.ReadKey(true);
})
{ IsBackground = true }.Start();
}
}
}

14
samples/ControlCatalog.NetCore/ControlCatalog.NetCore.csproj

@ -6,6 +6,12 @@
<TargetLatestRuntimePatch>true</TargetLatestRuntimePatch>
</PropertyGroup>
<PropertyGroup Condition="$(RunAotCompilation)">
<IlcTrimMetadata>true</IlcTrimMetadata>
<RestoreAdditionalProjectSources>https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet7/nuget/v3/index.json</RestoreAdditionalProjectSources>
<NativeAotCompilerVersion>7.0.0-*</NativeAotCompilerVersion>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\..\src\Avalonia.Headless.Vnc\Avalonia.Headless.Vnc.csproj" />
<ProjectReference Include="..\..\src\Avalonia.Dialogs\Avalonia.Dialogs.csproj" />
@ -15,6 +21,14 @@
<PackageReference Include="Avalonia.Angle.Windows.Natives" Version="2.1.0.2020091801" />
</ItemGroup>
<ItemGroup Condition="$(RunAotCompilation)">
<PackageReference Include="Microsoft.DotNet.ILCompiler" Version="$(NativeAotCompilerVersion)" />
<!-- Cross-compilation for Windows x64-arm64 and Linux x64-arm64 -->
<PackageReference Condition="'$(RuntimeIdentifier)'=='win-arm64'" Include="runtime.win-x64.Microsoft.DotNet.ILCompiler" Version="$(NativeAotCompilerVersion)" />
<PackageReference Condition="'$(RuntimeIdentifier)'=='linux-arm64'" Include="runtime.linux-x64.Microsoft.DotNet.ILCompiler" Version="$(NativeAotCompilerVersion)" />
<RdXmlFile Include="rd.xml" />
</ItemGroup>
<PropertyGroup>
<!-- For Microsoft.CodeAnalysis -->
<SatelliteResourceLanguages>en</SatelliteResourceLanguages>

0
samples/ControlCatalog.NetCore.Native/rd.xml → samples/ControlCatalog.NetCore/rd.xml

Loading…
Cancel
Save