Merge branch 'master' of github.com:teobugslayer/AvaloniaCoreRTDemo
This commit is contained in:
commit
a408bd242f
12
README.md
12
README.md
@ -1,10 +1,10 @@
|
|||||||
This project shows how to integrate [Avalonia UI](https://avaloniaui.net) and [CoreRT](https://github.com/dotnet/corert). Both frameworks are incredible from a technical standpoint. However, they are under constant, heavy development, are not well documented, and require subtle knowledge spread across multiple sources.
|
This project shows how to integrate [Avalonia UI](https://avaloniaui.net) and [CoreRT](https://github.com/dotnet/corert). Both frameworks are under heavy development, have sparce documentation, and require subtle knowledge spread across multiple sources.
|
||||||
Using this project, you will learn how to develop using both frameworks. You may also use it as a skeleton for your projects.
|
Using this project, you will learn how to develop using both frameworks. You may also use it as a starting point for your projects.
|
||||||
|
|
||||||
## System requirements
|
## System requirements
|
||||||
This project was tested only under Windows, and this readme assumes you are using Windows. To build this project, you need:
|
This project is tested only under Windows, and this readme assumes you are using Windows. To build this project, you need:
|
||||||
|
|
||||||
* Any supported 64-bit edition of Windows. CoreRT produces only 64-bit Windows apps.
|
* Any supported 64-bit edition of Windows. CoreRT requires 64-bit Windows and produces only 64-bit Windows apps.
|
||||||
* Visual Studio. VS 20019 Community is free for personal use. Get if from [here](https://visualstudio.microsoft.com).
|
* Visual Studio. VS 20019 Community is free for personal use. Get if from [here](https://visualstudio.microsoft.com).
|
||||||
When installing Visual Studio, select *.NET desktop development* and *Desktop development with C++* workloads. To generate native code, CoreRT requires the native C++ toolchain and Windows SDK. This configuration ensures you have them.
|
When installing Visual Studio, select *.NET desktop development* and *Desktop development with C++* workloads. To generate native code, CoreRT requires the native C++ toolchain and Windows SDK. This configuration ensures you have them.
|
||||||
* .Net Core SDK. At the time of writing, .Net Core 5.0 is in a preview state. Download it from [here](https://dotnet.microsoft.com/download/dotnet/5.0). Note: Make sure that you download and install the *SDK*. The runtime is not enough for building apps.
|
* .Net Core SDK. At the time of writing, .Net Core 5.0 is in a preview state. Download it from [here](https://dotnet.microsoft.com/download/dotnet/5.0). Note: Make sure that you download and install the *SDK*. The runtime is not enough for building apps.
|
||||||
@ -26,13 +26,13 @@ Then, build the sample:
|
|||||||
```bash
|
```bash
|
||||||
dotnet publish -r win-x64 -c release
|
dotnet publish -r win-x64 -c release
|
||||||
```
|
```
|
||||||
**Note**: Avalonia and CoreRT are huge. Downloading them might take some time. During this period, which happens on the first build, and when CoreRT releases a new version, it will look like nothing happens. Just be patient.
|
**Note**: Avalonia and CoreRT are huge and downloading their NuGet packages may take some time. During this period, which happens on the first build, and when CoreRT releases a new version, it will look like nothing happens. Just be patient.
|
||||||
|
|
||||||
We are ready - In your terminal, navigate to `src\bin\Release\net5.0\win-x64\publish`, and start AvaloniaCoreRTDemo.exe - it should work!
|
We are ready - In your terminal, navigate to `src\bin\Release\net5.0\win-x64\publish`, and start AvaloniaCoreRTDemo.exe - it should work!
|
||||||
|
|
||||||
### Background information
|
### Background information
|
||||||
|
|
||||||
At the time of writing, there's an incompatibility between the current version of Avalonia (0.9.9) and CoreRT, which we need to solve. To give you context, CoreRT is an ahead-of-time compiler, and specific code patterns cannot be used with it, while JIT compilers handle them easily. One such pattern is the infinite generic type expansions, and one of Avalonia dependencies [uses it](https://github.com/dotnet/corert/issues/7920#issuecomment-568536702). The library which uses this code has released a fixed version. However, Avalonia has not been updated yet. To solve this problem, we force the new version of the sub-dependency in the project file:
|
At the time of writing, there's an incompatibility between the current version of Avalonia (0.9.10) and CoreRT, which we need to solve. To give you context, CoreRT is an ahead-of-time compiler, and specific code patterns cannot be used with it, while JIT compilers handle them easily. One such pattern is the infinite generic type expansions, and one of Avalonia dependencies [uses it](https://github.com/dotnet/corert/issues/7920#issuecomment-568536702). The library which uses this code has released a fixed version. However, Avalonia has not been updated yet. To solve this problem, we force the new version of the sub-dependency in the project file:
|
||||||
|
|
||||||
```XML
|
```XML
|
||||||
<PackageReference Include="System.Reactive" Version="4.4.1" />
|
<PackageReference Include="System.Reactive" Version="4.4.1" />
|
||||||
|
@ -7,15 +7,15 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<!-- these can help when debugging weird exceptions especially when reflection is involved. See https://github.com/dotnet/corert/blob/master/Documentation/using-corert/optimizing-corert.md -->
|
<!-- these can help when debugging weird exceptions especially when reflection is involved. See https://github.com/dotnet/corert/blob/master/Documentation/using-corert/optimizing-corert.md -->
|
||||||
<RootAllApplicationAssemblies>false</RootAllApplicationAssemblies>
|
<RootAllApplicationAssemblies>false</RootAllApplicationAssemblies>
|
||||||
<IlcGenerateCompleteTypeMetadata>false</IlcGenerateCompleteTypeMetadata>
|
<IlcGenerateCompleteTypeMetadata>false</IlcGenerateCompleteTypeMetadata>
|
||||||
<IlcGenerateStackTraceData>true</IlcGenerateStackTraceData>
|
<IlcGenerateStackTraceData>false</IlcGenerateStackTraceData>
|
||||||
<IlcDisableUnhandledExceptionExperience>false</IlcDisableUnhandledExceptionExperience>
|
<IlcDisableUnhandledExceptionExperience>true</IlcDisableUnhandledExceptionExperience>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup Condition="$(RuntimeIdentifier.StartsWith('win'))">
|
<ItemGroup Condition="$(RuntimeIdentifier.StartsWith('win'))">
|
||||||
<!-- Instruct CoreRT to use this native dependency, required to build Avalonia. This library comes from the Windows SDK. -->
|
<!-- Instruct CoreRT to use this native dependency, required to build Avalonia. This library comes from the Windows SDK. -->
|
||||||
<NativeLibrary Include="WindowsApp.lib" />
|
<NativeLibrary Include="WindowsApp.lib" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
@ -32,15 +32,15 @@
|
|||||||
<EmbeddedResource Include="windows.png" />
|
<EmbeddedResource Include="windows.png" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Avalonia" Version="0.9.9" />
|
<PackageReference Include="Avalonia" Version="0.9.10" />
|
||||||
<PackageReference Include="Avalonia.Desktop" Version="0.9.9" />
|
<PackageReference Include="Avalonia.Desktop" Version="0.9.10" />
|
||||||
<PackageReference Include="Avalonia.ReactiveUI" Version="0.9.9" />
|
<PackageReference Include="Avalonia.ReactiveUI" Version="0.9.10" />
|
||||||
<PackageReference Include="Microsoft.DotNet.ILCompiler" Version="1.0.0-alpha-*" />
|
<PackageReference Include="Microsoft.DotNet.ILCompiler" Version="1.0.0-alpha-*" />
|
||||||
<!-- This is a hack. Avalonia 0.9.7 depends on a version of System.Reactive prior 4.4.1, which contains a critical fix for building with CoreRT -->
|
<!-- This is a hack. Avalonia 0.9.10 depends on a version of System.Reactive prior 4.4.1, which contains a critical fix for building with CoreRT -->
|
||||||
<PackageReference Include="System.Reactive" Version="4.4.1" />
|
<PackageReference Include="System.Reactive" Version="4.4.1" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<!-- Avalonis relies heavily on reflection. Describe types needed here. -->
|
<!-- Avalonia relies heavily on reflection. Describe types reflected upon here. -->
|
||||||
<RdXmlFile Include="rd.xml" />
|
<RdXmlFile Include="rd.xml" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
<configuration>
|
<configuration>
|
||||||
<packageSources>
|
<packageSources>
|
||||||
<add key="AvaloniaCI" value="https://www.myget.org/F/avalonia-ci/api/v2" />
|
<add key="AvaloniaCI" value="https://www.myget.org/F/avalonia-ci/api/v2" />
|
||||||
|
<add key="dotnet5" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet5/nuget/v3/index.json" />
|
||||||
<add key="dotnet-core" value="https://dotnetfeed.blob.core.windows.net/dotnet-core/index.json" />
|
<add key="dotnet-core" value="https://dotnetfeed.blob.core.windows.net/dotnet-core/index.json" />
|
||||||
<add key="nuget" value="https://api.nuget.org/v3/index.json" />
|
<add key="nuget" value="https://api.nuget.org/v3/index.json" />
|
||||||
</packageSources>
|
</packageSources>
|
||||||
|
@ -18,27 +18,21 @@
|
|||||||
<Assembly Name="Avalonia.Markup" Dynamic="Required All"></Assembly>
|
<Assembly Name="Avalonia.Markup" Dynamic="Required All"></Assembly>
|
||||||
<Assembly Name="Avalonia.Markup.Xaml" Dynamic="Required All"></Assembly>
|
<Assembly Name="Avalonia.Markup.Xaml" Dynamic="Required All"></Assembly>
|
||||||
<Assembly Name="Avalonia.Styling" Dynamic="Required All"></Assembly>
|
<Assembly Name="Avalonia.Styling" Dynamic="Required All"></Assembly>
|
||||||
|
|
||||||
<Assembly Name="Avalonia.DesktopRuntime" Dynamic="Required All"></Assembly>
|
<Assembly Name="Avalonia.DesktopRuntime" Dynamic="Required All"></Assembly>
|
||||||
|
|
||||||
<Assembly Name="Avalonia.DesignerSupport" Dynamic="Required All"></Assembly>
|
<Assembly Name="Avalonia.DesignerSupport" Dynamic="Required All"></Assembly>
|
||||||
<Assembly Name="Avalonia.Diagnostics" Dynamic="Required All"></Assembly>
|
<Assembly Name="Avalonia.Diagnostics" Dynamic="Required All"></Assembly>
|
||||||
<Assembly Name="Avalonia.Dialogs" Dynamic="Required All"></Assembly>
|
<Assembly Name="Avalonia.Dialogs" Dynamic="Required All"></Assembly>
|
||||||
<Assembly Name="Avalonia.Input" Dynamic="Required All"></Assembly>
|
<Assembly Name="Avalonia.Input" Dynamic="Required All"></Assembly>
|
||||||
<Assembly Name="Avalonia.Logging.Serilog" Dynamic="Required All"></Assembly>
|
<Assembly Name="Avalonia.Logging.Serilog" Dynamic="Required All"></Assembly>
|
||||||
<Assembly Name="Avalonia.OpenGL" Dynamic="Required All"></Assembly>
|
<Assembly Name="Avalonia.OpenGL" Dynamic="Required All"></Assembly>
|
||||||
|
|
||||||
<Assembly Name="Avalonia.Desktop" Dynamic="Required All"></Assembly>
|
<Assembly Name="Avalonia.Desktop" Dynamic="Required All"></Assembly>
|
||||||
<Assembly Name="Avalonia.Direct2D1" Dynamic="Required All"></Assembly>
|
<Assembly Name="Avalonia.Direct2D1" Dynamic="Required All"></Assembly>
|
||||||
<Assembly Name="Avalonia.ReactiveUI" Dynamic="Required All"></Assembly>
|
<Assembly Name="Avalonia.ReactiveUI" Dynamic="Required All"></Assembly>
|
||||||
<Assembly Name="Avalonia.Skia" Dynamic="Required All"></Assembly>
|
<Assembly Name="Avalonia.Skia" Dynamic="Required All"></Assembly>
|
||||||
<Assembly Name="Avalonia.Win32" Dynamic="Required All"></Assembly>
|
<Assembly Name="Avalonia.Win32" Dynamic="Required All"></Assembly>
|
||||||
|
|
||||||
<Assembly Name="SkiaSharp" Dynamic="Required All"></Assembly>
|
|
||||||
<Assembly Name="ReactiveUI" Dynamic="Required All"></Assembly>
|
<Assembly Name="ReactiveUI" Dynamic="Required All"></Assembly>
|
||||||
<Assembly Name="System.Reactive" Dynamic="Required All"></Assembly>
|
<Assembly Name="System.Reactive" Dynamic="Required All"></Assembly>
|
||||||
<Assembly Name="Splat" Dynamic="Required All"></Assembly>
|
<Assembly Name="Splat" Dynamic="Required All"></Assembly>
|
||||||
-->
|
-->
|
||||||
|
|
||||||
</Application>
|
</Application>
|
||||||
</Directives>
|
</Directives>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user