From 8fc20ecac1345f7704244e470b74226946b285fc Mon Sep 17 00:00:00 2001 From: Maksym Katsydan Date: Mon, 14 Nov 2022 15:19:48 -0500 Subject: [PATCH 1/8] Update csharp templates --- azure-pipelines.yml | 2 +- readme.md | 2 +- .../app-mvvm/AvaloniaAppTemplate.csproj | 11 +- templates/csharp/app-mvvm/Roots.xml | 5 + .../csharp/app/.template.config/template.json | 4 +- .../csharp/app/AvaloniaAppTemplate.csproj | 18 +-- templates/csharp/app/Roots.xml | 5 + .../AvaloniaTest.Android.csproj | 14 +- .../AvaloniaTest.Desktop.csproj | 17 +- .../xplat/AvaloniaTest.Desktop/app.manifest | 18 +++ .../csharp/xplat/AvaloniaTest.Web/App.razor | 10 -- .../xplat/AvaloniaTest.Web/App.razor.cs | 14 -- .../{wwwroot => AppBundle}/Logo.svg | 0 .../xplat/AvaloniaTest.Web/AppBundle/app.css | 153 ++++++++++++++++++ .../{wwwroot => AppBundle}/favicon.ico | Bin .../AvaloniaTest.Web/AppBundle/index.html | 32 ++++ .../xplat/AvaloniaTest.Web/AppBundle/main.js | 16 ++ .../AvaloniaTest.Web/AvaloniaTest.Web.csproj | 35 ++-- .../xplat/AvaloniaTest.Web/Pages/Index.razor | 3 - .../csharp/xplat/AvaloniaTest.Web/Program.cs | 38 ++--- .../Properties/launchSettings.json | 19 +-- .../AvaloniaTest.Web/Shared/MainLayout.razor | 7 - .../Shared/MainLayout.razor.css | 70 -------- .../xplat/AvaloniaTest.Web/_Imports.razor | 11 -- .../runtimeconfig.template.json | 11 ++ .../AvaloniaTest.Web/wwwroot/css/app.css | 79 --------- .../xplat/AvaloniaTest.Web/wwwroot/index.html | 32 ---- .../xplat/AvaloniaTest.Web/wwwroot/js/app.js | 1 - .../AvaloniaTest.iOS/AvaloniaTest.iOS.csproj | 2 +- .../xplat/AvaloniaTest/AvaloniaTest.csproj | 8 +- templates/csharp/xplat/AvaloniaTest/Roots.xml | 5 + templates/csharp/xplat/Directory.Build.props | 3 +- templates/csharp/xplat/global.json | 9 +- 33 files changed, 307 insertions(+), 347 deletions(-) create mode 100644 templates/csharp/app-mvvm/Roots.xml create mode 100644 templates/csharp/app/Roots.xml create mode 100644 templates/csharp/xplat/AvaloniaTest.Desktop/app.manifest delete mode 100644 templates/csharp/xplat/AvaloniaTest.Web/App.razor delete mode 100644 templates/csharp/xplat/AvaloniaTest.Web/App.razor.cs rename templates/csharp/xplat/AvaloniaTest.Web/{wwwroot => AppBundle}/Logo.svg (100%) create mode 100644 templates/csharp/xplat/AvaloniaTest.Web/AppBundle/app.css rename templates/csharp/xplat/AvaloniaTest.Web/{wwwroot => AppBundle}/favicon.ico (100%) create mode 100644 templates/csharp/xplat/AvaloniaTest.Web/AppBundle/index.html create mode 100644 templates/csharp/xplat/AvaloniaTest.Web/AppBundle/main.js delete mode 100644 templates/csharp/xplat/AvaloniaTest.Web/Pages/Index.razor delete mode 100644 templates/csharp/xplat/AvaloniaTest.Web/Shared/MainLayout.razor delete mode 100644 templates/csharp/xplat/AvaloniaTest.Web/Shared/MainLayout.razor.css delete mode 100644 templates/csharp/xplat/AvaloniaTest.Web/_Imports.razor create mode 100644 templates/csharp/xplat/AvaloniaTest.Web/runtimeconfig.template.json delete mode 100644 templates/csharp/xplat/AvaloniaTest.Web/wwwroot/css/app.css delete mode 100644 templates/csharp/xplat/AvaloniaTest.Web/wwwroot/index.html delete mode 100644 templates/csharp/xplat/AvaloniaTest.Web/wwwroot/js/app.js create mode 100644 templates/csharp/xplat/AvaloniaTest/Roots.xml diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 3b802cb3..44d3f0d9 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -18,7 +18,7 @@ steps: inputs: script: 'dotnet new -i $(Build.ArtifactStagingDirectory)/NuGet/*.nupkg' - task: CmdLine@2 - displayName: 'Install WASM workload' + displayName: 'Install workload' inputs: script: 'dotnet workload install --no-cache --disable-parallel ios android wasm-tools wasm-experimental' - task: PowerShell@2 diff --git a/readme.md b/readme.md index 0fe8ba32..6a4dc2b3 100644 --- a/readme.md +++ b/readme.md @@ -45,7 +45,7 @@ Available parameters: *Description*: The target version of Avalonia NuGet packages. -*Options*: **0.10.18**, **11.0.0-preview3** +*Options*: **0.10.18**, **11.0.0-preview4** *By default*: 0.10.18 diff --git a/templates/csharp/app-mvvm/AvaloniaAppTemplate.csproj b/templates/csharp/app-mvvm/AvaloniaAppTemplate.csproj index 07ede136..05616939 100644 --- a/templates/csharp/app-mvvm/AvaloniaAppTemplate.csproj +++ b/templates/csharp/app-mvvm/AvaloniaAppTemplate.csproj @@ -3,22 +3,19 @@ WinExe net6.0 enable - - copyused true + + - - - + + diff --git a/templates/csharp/app-mvvm/Roots.xml b/templates/csharp/app-mvvm/Roots.xml new file mode 100644 index 00000000..828fb952 --- /dev/null +++ b/templates/csharp/app-mvvm/Roots.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/templates/csharp/app/.template.config/template.json b/templates/csharp/app/.template.config/template.json index 15f5926a..18126f40 100644 --- a/templates/csharp/app/.template.config/template.json +++ b/templates/csharp/app/.template.config/template.json @@ -38,8 +38,8 @@ "description": "Target 0.10.18 (Latest stable)." }, { - "choice": "11.0.0-preview3", - "description": "Target 11.0.0-preview3" + "choice": "11.0.0-preview4", + "description": "Target 11.0.0-preview4" } ], "defaultValue": "0.10.18" diff --git a/templates/csharp/app/AvaloniaAppTemplate.csproj b/templates/csharp/app/AvaloniaAppTemplate.csproj index 718594af..f1b4fd22 100644 --- a/templates/csharp/app/AvaloniaAppTemplate.csproj +++ b/templates/csharp/app/AvaloniaAppTemplate.csproj @@ -3,20 +3,16 @@ WinExe net6.0 enable - - copyused true + - - - + + @@ -24,11 +20,11 @@ - - - + + + - + diff --git a/templates/csharp/app/Roots.xml b/templates/csharp/app/Roots.xml new file mode 100644 index 00000000..828fb952 --- /dev/null +++ b/templates/csharp/app/Roots.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/templates/csharp/xplat/AvaloniaTest.Android/AvaloniaTest.Android.csproj b/templates/csharp/xplat/AvaloniaTest.Android/AvaloniaTest.Android.csproj index 4071fb43..f2994e76 100644 --- a/templates/csharp/xplat/AvaloniaTest.Android/AvaloniaTest.Android.csproj +++ b/templates/csharp/xplat/AvaloniaTest.Android/AvaloniaTest.Android.csproj @@ -1,32 +1,26 @@ Exe - net6.0-android + net7.0-android 21 enable com.CompanyName.AvaloniaTest 1 1.0 apk + False + Resources\drawable\Icon.png - - True - True - True - - - - - + diff --git a/templates/csharp/xplat/AvaloniaTest.Desktop/AvaloniaTest.Desktop.csproj b/templates/csharp/xplat/AvaloniaTest.Desktop/AvaloniaTest.Desktop.csproj index 6e6308eb..e917d1e5 100644 --- a/templates/csharp/xplat/AvaloniaTest.Desktop/AvaloniaTest.Desktop.csproj +++ b/templates/csharp/xplat/AvaloniaTest.Desktop/AvaloniaTest.Desktop.csproj @@ -1,24 +1,21 @@  WinExe - net6.0 + net7.0 enable - - copyused true - - - - - + + + app.manifest + + + diff --git a/templates/csharp/xplat/AvaloniaTest.Desktop/app.manifest b/templates/csharp/xplat/AvaloniaTest.Desktop/app.manifest new file mode 100644 index 00000000..dfdb7d3e --- /dev/null +++ b/templates/csharp/xplat/AvaloniaTest.Desktop/app.manifest @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + diff --git a/templates/csharp/xplat/AvaloniaTest.Web/App.razor b/templates/csharp/xplat/AvaloniaTest.Web/App.razor deleted file mode 100644 index b941644e..00000000 --- a/templates/csharp/xplat/AvaloniaTest.Web/App.razor +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - -

Sorry, there's nothing at this address.

-
-
-
diff --git a/templates/csharp/xplat/AvaloniaTest.Web/App.razor.cs b/templates/csharp/xplat/AvaloniaTest.Web/App.razor.cs deleted file mode 100644 index e761ee8c..00000000 --- a/templates/csharp/xplat/AvaloniaTest.Web/App.razor.cs +++ /dev/null @@ -1,14 +0,0 @@ -using Avalonia.Web.Blazor; - -namespace AvaloniaTest.Web; - -public partial class App -{ - protected override void OnParametersSet() - { - base.OnParametersSet(); - - WebAppBuilder.Configure() - .SetupWithSingleViewLifetime(); - } -} \ No newline at end of file diff --git a/templates/csharp/xplat/AvaloniaTest.Web/wwwroot/Logo.svg b/templates/csharp/xplat/AvaloniaTest.Web/AppBundle/Logo.svg similarity index 100% rename from templates/csharp/xplat/AvaloniaTest.Web/wwwroot/Logo.svg rename to templates/csharp/xplat/AvaloniaTest.Web/AppBundle/Logo.svg diff --git a/templates/csharp/xplat/AvaloniaTest.Web/AppBundle/app.css b/templates/csharp/xplat/AvaloniaTest.Web/AppBundle/app.css new file mode 100644 index 00000000..a83e9fd3 --- /dev/null +++ b/templates/csharp/xplat/AvaloniaTest.Web/AppBundle/app.css @@ -0,0 +1,153 @@ +/* HTML styles for the splash screen */ + +.center { + display: flex; + justify-content: center; + align-items: center; + height: 100vh; +} + +#avalonia-splash { + position: absolute; + height: 100%; + width: 100%; + background: radial-gradient(#16A757, #116336); + justify-content: center; + align-items: center; +} + +.splash-close { + animation: fadeout 0.3s linear forwards; +} + +.spinner-container { + display: flex; + position: absolute; + height: 100%; + width: 100%; + justify-content: center; + align-items: center; + animation: delayedFadeIn 4s linear both; + background: transparent; +} + +.noise-container { + opacity: 70%; + position: absolute; + height: 100%; + width: 100%; + overflow: hidden; +} + +#out { + position: absolute; + height: 100%; + width: 100%; + z-index: 1; +} + +@keyframes fadeout { + 0% { + opacity: 100%; + } + + 100% { + opacity: 0; + visibility: collapse; + left: 100%; + } +} + +@keyframes delayedFadeIn { + 0% { + visibility: collapse; + } + + 99% { + visibility: collapse; + } + + 100% { + visibility: visible; + } +} + +.loader { + animation: rotate 1s infinite; + height: 50px; + width: 50px; +} + +.loader:before, .loader:after { + border-radius: 50%; + content: ''; + display: block; + height: 20px; + width: 20px; +} + +.loader:before { + animation: ball1 1s infinite; + background-color: white; + box-shadow: 30px 0 0 white; + margin-bottom: 10px; +} + +.loader:after { + animation: ball2 1s infinite; + background-color: white; + box-shadow: 30px 0 0 white; +} + +@keyframes rotate { + 0% { + -webkit-transform: rotate(0deg) scale(0.8); + -moz-transform: rotate(0deg) scale(0.8); + } + + 50% { + -webkit-transform: rotate(360deg) scale(1.2); + -moz-transform: rotate(360deg) scale(1.2); + } + + 100% { + -webkit-transform: rotate(720deg) scale(0.8); + -moz-transform: rotate(720deg) scale(0.8); + } +} + +@keyframes ball1 { + 0% { + box-shadow: 30px 0 0 white; + } + + 50% { + box-shadow: 0 0 0 white; + margin-bottom: 0; + -webkit-transform: translate(15px,15px); + -moz-transform: translate(15px, 15px); + } + + 100% { + box-shadow: 30px 0 0 white; + margin-bottom: 10px; + } +} + +@keyframes ball2 { + 0% { + box-shadow: 30px 0 0 white; + } + + 50% { + box-shadow: 0 0 0 white; + margin-top: -20px; + -webkit-transform: translate(15px,15px); + -moz-transform: translate(15px, 15px); + } + + 100% { + box-shadow: 30px 0 0 white; + margin-top: 0; + } +} diff --git a/templates/csharp/xplat/AvaloniaTest.Web/wwwroot/favicon.ico b/templates/csharp/xplat/AvaloniaTest.Web/AppBundle/favicon.ico similarity index 100% rename from templates/csharp/xplat/AvaloniaTest.Web/wwwroot/favicon.ico rename to templates/csharp/xplat/AvaloniaTest.Web/AppBundle/favicon.ico diff --git a/templates/csharp/xplat/AvaloniaTest.Web/AppBundle/index.html b/templates/csharp/xplat/AvaloniaTest.Web/AppBundle/index.html new file mode 100644 index 00000000..e5b247b6 --- /dev/null +++ b/templates/csharp/xplat/AvaloniaTest.Web/AppBundle/index.html @@ -0,0 +1,32 @@ + + + + + AvaloniaTest.Web + + + + + + + + + + + + +
+ Avalonia Logo +
+
+

+ Powered by + Avalonia UI +

+
+
+
+ + + + \ No newline at end of file diff --git a/templates/csharp/xplat/AvaloniaTest.Web/AppBundle/main.js b/templates/csharp/xplat/AvaloniaTest.Web/AppBundle/main.js new file mode 100644 index 00000000..2426ede9 --- /dev/null +++ b/templates/csharp/xplat/AvaloniaTest.Web/AppBundle/main.js @@ -0,0 +1,16 @@ +import { dotnet } from './dotnet.js' +import { registerAvaloniaModule } from './avalonia.js'; + +const is_browser = typeof window != "undefined"; +if (!is_browser) throw new Error(`Expected to be running in a browser`); + +const dotnetRuntime = await dotnet + .withDiagnosticTracing(false) + .withApplicationArgumentsFromQuery() + .create(); + +await registerAvaloniaModule(dotnetRuntime); + +const config = dotnetRuntime.getConfig(); + +await dotnetRuntime.runMainAndExit(config.mainAssemblyName, [window.location.search]); \ No newline at end of file diff --git a/templates/csharp/xplat/AvaloniaTest.Web/AvaloniaTest.Web.csproj b/templates/csharp/xplat/AvaloniaTest.Web/AvaloniaTest.Web.csproj index f2a71719..d719e3d0 100644 --- a/templates/csharp/xplat/AvaloniaTest.Web/AvaloniaTest.Web.csproj +++ b/templates/csharp/xplat/AvaloniaTest.Web/AvaloniaTest.Web.csproj @@ -1,35 +1,20 @@ - + - net6.0 - enable - - true - 16777216 + net7.0 + browser-wasm + AppBundle\main.js + Exe - - - false - -O1 - false - - - - true - true - -O3 - -O3 - true - - - - - + + + + + - diff --git a/templates/csharp/xplat/AvaloniaTest.Web/Pages/Index.razor b/templates/csharp/xplat/AvaloniaTest.Web/Pages/Index.razor deleted file mode 100644 index 3fccef9a..00000000 --- a/templates/csharp/xplat/AvaloniaTest.Web/Pages/Index.razor +++ /dev/null @@ -1,3 +0,0 @@ -@page "/" - - diff --git a/templates/csharp/xplat/AvaloniaTest.Web/Program.cs b/templates/csharp/xplat/AvaloniaTest.Web/Program.cs index 18e2957a..9c1524c3 100644 --- a/templates/csharp/xplat/AvaloniaTest.Web/Program.cs +++ b/templates/csharp/xplat/AvaloniaTest.Web/Program.cs @@ -1,29 +1,15 @@ -using System; -using System.Net.Http; -using System.Threading.Tasks; -using AvaloniaTest.Web; -using Microsoft.AspNetCore.Components.WebAssembly.Hosting; -using Microsoft.Extensions.DependencyInjection; - -public class Program -{ - public static async Task Main(string[] args) - { - await CreateHostBuilder(args).Build().RunAsync(); - } - - public static WebAssemblyHostBuilder CreateHostBuilder(string[] args) - { - var builder = WebAssemblyHostBuilder.CreateDefault(args); - - builder.RootComponents.Add("#app"); - - builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri(builder.HostEnvironment.BaseAddress) }); - - return builder; - } -} - +using System.Runtime.Versioning; +using Avalonia; +using Avalonia.Web; +using AvaloniaTest; +[assembly: SupportedOSPlatform("browser")] +internal partial class Program +{ + private static void Main(string[] args) => BuildAvaloniaApp() + .SetupBrowserApp("out"); + public static AppBuilder BuildAvaloniaApp() + => AppBuilder.Configure(); +} \ No newline at end of file diff --git a/templates/csharp/xplat/AvaloniaTest.Web/Properties/launchSettings.json b/templates/csharp/xplat/AvaloniaTest.Web/Properties/launchSettings.json index 99348804..d50b4ffe 100644 --- a/templates/csharp/xplat/AvaloniaTest.Web/Properties/launchSettings.json +++ b/templates/csharp/xplat/AvaloniaTest.Web/Properties/launchSettings.json @@ -1,22 +1,13 @@ { - "iisSettings": { - "windowsAuthentication": false, - "anonymousAuthentication": true, - "iisExpress": { - "applicationUrl": "http://localhost:13961", - "sslPort": 44319 - } - }, "profiles": { - "Browser": { + "AvaloniaTest.Web": { "commandName": "Project", - "dotnetRunMessages": "true", "launchBrowser": true, - "inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}", - "applicationUrl": "https://localhost:5001;http://localhost:5000", "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" - } + }, + "applicationUrl": "https://localhost:5001;http://localhost:5000", + "inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/debug?browser={browserInspectUri}" } } -} +} \ No newline at end of file diff --git a/templates/csharp/xplat/AvaloniaTest.Web/Shared/MainLayout.razor b/templates/csharp/xplat/AvaloniaTest.Web/Shared/MainLayout.razor deleted file mode 100644 index 63fb1771..00000000 --- a/templates/csharp/xplat/AvaloniaTest.Web/Shared/MainLayout.razor +++ /dev/null @@ -1,7 +0,0 @@ -@inherits LayoutComponentBase - -
-
- @Body -
-
diff --git a/templates/csharp/xplat/AvaloniaTest.Web/Shared/MainLayout.razor.css b/templates/csharp/xplat/AvaloniaTest.Web/Shared/MainLayout.razor.css deleted file mode 100644 index 43c355a4..00000000 --- a/templates/csharp/xplat/AvaloniaTest.Web/Shared/MainLayout.razor.css +++ /dev/null @@ -1,70 +0,0 @@ -.page { - position: relative; - display: flex; - flex-direction: column; -} - -.main { - flex: 1; -} - -.sidebar { - background-image: linear-gradient(180deg, rgb(5, 39, 103) 0%, #3a0647 70%); -} - -.top-row { - background-color: #f7f7f7; - border-bottom: 1px solid #d6d5d5; - justify-content: flex-end; - height: 3.5rem; - display: flex; - align-items: center; -} - - .top-row ::deep a, .top-row .btn-link { - white-space: nowrap; - margin-left: 1.5rem; - } - - .top-row a:first-child { - overflow: hidden; - text-overflow: ellipsis; - } - -@media (max-width: 640.98px) { - .top-row:not(.auth) { - display: none; - } - - .top-row.auth { - justify-content: space-between; - } - - .top-row a, .top-row .btn-link { - margin-left: 0; - } -} - -@media (min-width: 641px) { - .page { - flex-direction: row; - } - - .sidebar { - width: 250px; - height: 100vh; - position: sticky; - top: 0; - } - - .top-row { - position: sticky; - top: 0; - z-index: 1; - } - - .main > div { - padding-left: 2rem !important; - padding-right: 1.5rem !important; - } -} diff --git a/templates/csharp/xplat/AvaloniaTest.Web/_Imports.razor b/templates/csharp/xplat/AvaloniaTest.Web/_Imports.razor deleted file mode 100644 index d0ee87ef..00000000 --- a/templates/csharp/xplat/AvaloniaTest.Web/_Imports.razor +++ /dev/null @@ -1,11 +0,0 @@ -@using System.Net.Http -@using System.Net.Http.Json -@using Microsoft.AspNetCore.Components.Forms -@using Microsoft.AspNetCore.Components.Routing -@using Microsoft.AspNetCore.Components.Web -@using Microsoft.AspNetCore.Components.Web.Virtualization -@using Microsoft.AspNetCore.Components.WebAssembly.Http -@using Microsoft.JSInterop -@using Avalonia.Web.Blazor -@using AvaloniaTest.Web -@using AvaloniaTest.Web.Shared diff --git a/templates/csharp/xplat/AvaloniaTest.Web/runtimeconfig.template.json b/templates/csharp/xplat/AvaloniaTest.Web/runtimeconfig.template.json new file mode 100644 index 00000000..c6990ba7 --- /dev/null +++ b/templates/csharp/xplat/AvaloniaTest.Web/runtimeconfig.template.json @@ -0,0 +1,11 @@ +{ + "wasmHostProperties": { + "perHostConfig": [ + { + "name": "browser", + "html-path": "index.html", + "Host": "browser" + } + ] + } +} \ No newline at end of file diff --git a/templates/csharp/xplat/AvaloniaTest.Web/wwwroot/css/app.css b/templates/csharp/xplat/AvaloniaTest.Web/wwwroot/css/app.css deleted file mode 100644 index 3c2b8894..00000000 --- a/templates/csharp/xplat/AvaloniaTest.Web/wwwroot/css/app.css +++ /dev/null @@ -1,79 +0,0 @@ -html, body { - font-family: "Nunito", sans-serif; - margin: 0; - height: 100vh; - overflow: hidden; -} - -a { - text-decoration: none; - color: white; -} - -#blazor-error-ui { - background: lightyellow; - bottom: 0; - box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2); - display: none; - left: 0; - padding: 0.6rem 1.25rem 0.7rem 1.25rem; - position: fixed; - width: 100%; - z-index: 1000; -} - - #blazor-error-ui .dismiss { - cursor: pointer; - position: absolute; - right: 0.75rem; - top: 0.5rem; - } - -.canvas-container { - opacity:1; - position:fixed; - width:100%; - height:100%; - top:0px; - left:0px; - z-index:500; -} - -canvas -{ - opacity:1; - position:fixed; - width:100%; - height:100%; - top:0px; - left:0px; - z-index:500; -} - -#app, .page { - height: 100%; - background: #171C2C; - color: white; -} - -.navbar-brand { - font-size: 22px; -} - -.overlay{ - opacity:0.0; - position:fixed; - width:100vw; - height:100vh; - top:0px; - left:0px; - z-index:1000; -} - -#splash { - display: flex; - justify-content: center; - align-items: center; - text-align: center; - min-height: 100vh; -} \ No newline at end of file diff --git a/templates/csharp/xplat/AvaloniaTest.Web/wwwroot/index.html b/templates/csharp/xplat/AvaloniaTest.Web/wwwroot/index.html deleted file mode 100644 index 71dc0cf9..00000000 --- a/templates/csharp/xplat/AvaloniaTest.Web/wwwroot/index.html +++ /dev/null @@ -1,32 +0,0 @@ - - - - - - - Avalonia Sample - - - - - -
-
-

Powered by

- - Avalonia Logo - Avalonia - -
-
- -
- An unhandled error has occurred. - Reload - 🗙 -
- - - - - diff --git a/templates/csharp/xplat/AvaloniaTest.Web/wwwroot/js/app.js b/templates/csharp/xplat/AvaloniaTest.Web/wwwroot/js/app.js deleted file mode 100644 index 5f282702..00000000 --- a/templates/csharp/xplat/AvaloniaTest.Web/wwwroot/js/app.js +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/templates/csharp/xplat/AvaloniaTest.iOS/AvaloniaTest.iOS.csproj b/templates/csharp/xplat/AvaloniaTest.iOS/AvaloniaTest.iOS.csproj index aa84808f..ede2c6c4 100644 --- a/templates/csharp/xplat/AvaloniaTest.iOS/AvaloniaTest.iOS.csproj +++ b/templates/csharp/xplat/AvaloniaTest.iOS/AvaloniaTest.iOS.csproj @@ -1,7 +1,7 @@  Exe - net6.0-ios16.0 + net7.0-ios 10.0 manual enable diff --git a/templates/csharp/xplat/AvaloniaTest/AvaloniaTest.csproj b/templates/csharp/xplat/AvaloniaTest/AvaloniaTest.csproj index eba7510d..f8ee991a 100644 --- a/templates/csharp/xplat/AvaloniaTest/AvaloniaTest.csproj +++ b/templates/csharp/xplat/AvaloniaTest/AvaloniaTest.csproj @@ -1,16 +1,18 @@  - net6.0 + net7.0 enable latest - + + + + - diff --git a/templates/csharp/xplat/AvaloniaTest/Roots.xml b/templates/csharp/xplat/AvaloniaTest/Roots.xml new file mode 100644 index 00000000..ae3389c1 --- /dev/null +++ b/templates/csharp/xplat/AvaloniaTest/Roots.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/templates/csharp/xplat/Directory.Build.props b/templates/csharp/xplat/Directory.Build.props index fcbfc3a7..6618107d 100644 --- a/templates/csharp/xplat/Directory.Build.props +++ b/templates/csharp/xplat/Directory.Build.props @@ -1,5 +1,6 @@ - 11.0.0-preview3 + enable + 11.0.0-preview4 diff --git a/templates/csharp/xplat/global.json b/templates/csharp/xplat/global.json index 4ec9a187..d97078cf 100644 --- a/templates/csharp/xplat/global.json +++ b/templates/csharp/xplat/global.json @@ -1,12 +1,5 @@ { "sdk": { - "version": "6.0.400", - "rollForward": "disable" - }, - "msbuild-sdks": { - "Microsoft.Build.Traversal": "1.0.43", - "Xamarin.Legacy.Sdk": "0.1.2-alpha6", - "MSBuild.Sdk.Extras": "3.0.22", - "AggregatePackage.NuGet.Sdk" : "0.1.12" + "version": "7.0.100" } } From 68cf14ae9ead2f78b80c08e0d08d7cf501dea215 Mon Sep 17 00:00:00 2001 From: Maksym Katsydan Date: Mon, 14 Nov 2022 15:19:57 -0500 Subject: [PATCH 2/8] Update some fsharp templates --- .../app-mvvm/AvaloniaAppTemplate.fsproj | 12 +++++----- templates/fsharp/app-mvvm/Roots.xml | 5 +++++ .../fsharp/app/.template.config/template.json | 4 ++-- .../fsharp/app/AvaloniaAppTemplate.fsproj | 20 ++++++++--------- templates/fsharp/app/Roots.xml | 5 +++++ .../AvaloniaTest.Android.fsproj | 12 +++------- .../AvaloniaTest.Desktop.fsproj | 22 +++++++++---------- .../xplat/AvaloniaTest.Desktop/app.manifest | 18 +++++++++++++++ .../AvaloniaTest.Web/AvaloniaTest.Web.fsproj | 2 +- .../AvaloniaTest.iOS/AvaloniaTest.iOS.fsproj | 2 +- .../xplat/AvaloniaTest/AvaloniaTest.fsproj | 9 +++++++- templates/fsharp/xplat/AvaloniaTest/Roots.xml | 5 +++++ templates/fsharp/xplat/Directory.Build.props | 2 +- 13 files changed, 73 insertions(+), 45 deletions(-) create mode 100644 templates/fsharp/app-mvvm/Roots.xml create mode 100644 templates/fsharp/app/Roots.xml create mode 100644 templates/fsharp/xplat/AvaloniaTest.Desktop/app.manifest create mode 100644 templates/fsharp/xplat/AvaloniaTest/Roots.xml diff --git a/templates/fsharp/app-mvvm/AvaloniaAppTemplate.fsproj b/templates/fsharp/app-mvvm/AvaloniaAppTemplate.fsproj index b3ba5730..aee035bd 100644 --- a/templates/fsharp/app-mvvm/AvaloniaAppTemplate.fsproj +++ b/templates/fsharp/app-mvvm/AvaloniaAppTemplate.fsproj @@ -2,15 +2,15 @@ WinExe net6.0 - - copyused true + + @@ -19,13 +19,11 @@ + - - - + + diff --git a/templates/fsharp/app-mvvm/Roots.xml b/templates/fsharp/app-mvvm/Roots.xml new file mode 100644 index 00000000..828fb952 --- /dev/null +++ b/templates/fsharp/app-mvvm/Roots.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/templates/fsharp/app/.template.config/template.json b/templates/fsharp/app/.template.config/template.json index 6cac1761..b795be6c 100644 --- a/templates/fsharp/app/.template.config/template.json +++ b/templates/fsharp/app/.template.config/template.json @@ -38,8 +38,8 @@ "description": "Target 0.10.18 (Latest stable)." }, { - "choice": "11.0.0-preview3", - "description": "Target 11.0.0-preview3" + "choice": "11.0.0-preview4", + "description": "Target 11.0.0-preview4" } ], "defaultValue": "0.10.18" diff --git a/templates/fsharp/app/AvaloniaAppTemplate.fsproj b/templates/fsharp/app/AvaloniaAppTemplate.fsproj index 476db906..45083dcc 100644 --- a/templates/fsharp/app/AvaloniaAppTemplate.fsproj +++ b/templates/fsharp/app/AvaloniaAppTemplate.fsproj @@ -2,25 +2,23 @@ WinExe net6.0 - - copyused true + + + - - - + + @@ -28,11 +26,11 @@ - - - + + + - + diff --git a/templates/fsharp/app/Roots.xml b/templates/fsharp/app/Roots.xml new file mode 100644 index 00000000..828fb952 --- /dev/null +++ b/templates/fsharp/app/Roots.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/templates/fsharp/xplat/AvaloniaTest.Android/AvaloniaTest.Android.fsproj b/templates/fsharp/xplat/AvaloniaTest.Android/AvaloniaTest.Android.fsproj index e8d930d7..2d9f8bd2 100644 --- a/templates/fsharp/xplat/AvaloniaTest.Android/AvaloniaTest.Android.fsproj +++ b/templates/fsharp/xplat/AvaloniaTest.Android/AvaloniaTest.Android.fsproj @@ -1,32 +1,26 @@ Exe - net6.0-android + net7.0-android 30 com.CompanyName.AvaloniaTest 1 1.0 apk + False + Resources\drawable\Icon.png - - True - True - True - - - - diff --git a/templates/fsharp/xplat/AvaloniaTest.Desktop/AvaloniaTest.Desktop.fsproj b/templates/fsharp/xplat/AvaloniaTest.Desktop/AvaloniaTest.Desktop.fsproj index acd5203c..daa82e61 100644 --- a/templates/fsharp/xplat/AvaloniaTest.Desktop/AvaloniaTest.Desktop.fsproj +++ b/templates/fsharp/xplat/AvaloniaTest.Desktop/AvaloniaTest.Desktop.fsproj @@ -1,26 +1,24 @@  WinExe - net6.0 - - copyused + net7.0 true + - - - + - - - - + + + app.manifest + + + + diff --git a/templates/fsharp/xplat/AvaloniaTest.Desktop/app.manifest b/templates/fsharp/xplat/AvaloniaTest.Desktop/app.manifest new file mode 100644 index 00000000..dfdb7d3e --- /dev/null +++ b/templates/fsharp/xplat/AvaloniaTest.Desktop/app.manifest @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + diff --git a/templates/fsharp/xplat/AvaloniaTest.Web/AvaloniaTest.Web.fsproj b/templates/fsharp/xplat/AvaloniaTest.Web/AvaloniaTest.Web.fsproj index 878e1b41..db142735 100644 --- a/templates/fsharp/xplat/AvaloniaTest.Web/AvaloniaTest.Web.fsproj +++ b/templates/fsharp/xplat/AvaloniaTest.Web/AvaloniaTest.Web.fsproj @@ -1,6 +1,6 @@  - net6.0 + net7.0 true 16777216 diff --git a/templates/fsharp/xplat/AvaloniaTest.iOS/AvaloniaTest.iOS.fsproj b/templates/fsharp/xplat/AvaloniaTest.iOS/AvaloniaTest.iOS.fsproj index 6ade58f4..f2ee70cc 100644 --- a/templates/fsharp/xplat/AvaloniaTest.iOS/AvaloniaTest.iOS.fsproj +++ b/templates/fsharp/xplat/AvaloniaTest.iOS/AvaloniaTest.iOS.fsproj @@ -1,7 +1,7 @@  Exe - net6.0-ios16.0 + net7.0-ios 10.0 manual enable diff --git a/templates/fsharp/xplat/AvaloniaTest/AvaloniaTest.fsproj b/templates/fsharp/xplat/AvaloniaTest/AvaloniaTest.fsproj index 10c8055e..91786d26 100644 --- a/templates/fsharp/xplat/AvaloniaTest/AvaloniaTest.fsproj +++ b/templates/fsharp/xplat/AvaloniaTest/AvaloniaTest.fsproj @@ -1,12 +1,14 @@  - net6.0 + net7.0 enable latest + + @@ -15,6 +17,11 @@ + + + + + diff --git a/templates/fsharp/xplat/AvaloniaTest/Roots.xml b/templates/fsharp/xplat/AvaloniaTest/Roots.xml new file mode 100644 index 00000000..ae3389c1 --- /dev/null +++ b/templates/fsharp/xplat/AvaloniaTest/Roots.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/templates/fsharp/xplat/Directory.Build.props b/templates/fsharp/xplat/Directory.Build.props index fcbfc3a7..cc2a5541 100644 --- a/templates/fsharp/xplat/Directory.Build.props +++ b/templates/fsharp/xplat/Directory.Build.props @@ -1,5 +1,5 @@ - 11.0.0-preview3 + 11.0.0-preview4 From 8458bba29471a8d1c5ddf72ee846ebe119578184 Mon Sep 17 00:00:00 2001 From: Maksym Katsydan Date: Mon, 14 Nov 2022 15:33:19 -0500 Subject: [PATCH 3/8] Restore ReactiveUI for the xplat and migrate to file scoped namespaces --- templates/csharp/app-mvvm/App.axaml.cs | 35 ++++++++-------- templates/csharp/app-mvvm/Program.cs | 33 ++++++++------- templates/csharp/app-mvvm/ViewLocator.cs | 33 ++++++++------- .../ViewModels/MainWindowViewModel.cs | 14 +++---- .../app-mvvm/ViewModels/ViewModelBase.cs | 7 ++-- .../csharp/app-mvvm/Views/MainWindow.axaml.cs | 11 +++-- templates/csharp/app/App.axaml.cs | 25 ++++++----- templates/csharp/app/MainWindow.axaml.cs | 11 +++-- templates/csharp/app/Program.cs | 29 +++++++------ .../NewTemplatedControl.axaml.cs | 7 ++-- .../usercontrol/NewUserControl.axaml.cs | 11 +++-- templates/csharp/window/NewWindow.axaml.cs | 11 +++-- .../AvaloniaTest.Android/MainActivity.cs | 9 ++-- .../AvaloniaTest.Android/SplashActivity.cs | 33 +++++++-------- .../xplat/AvaloniaTest.Desktop/Program.cs | 32 +++++++-------- .../csharp/xplat/AvaloniaTest.Web/Program.cs | 2 + .../xplat/AvaloniaTest.iOS/AppDelegate.cs | 17 ++++---- .../csharp/xplat/AvaloniaTest.iOS/Main.cs | 17 ++++---- .../csharp/xplat/AvaloniaTest/App.axaml.cs | 41 +++++++++---------- .../xplat/AvaloniaTest/AvaloniaTest.csproj | 1 + .../csharp/xplat/AvaloniaTest/ViewLocator.cs | 35 ++++++++-------- .../AvaloniaTest/ViewModels/MainViewModel.cs | 9 ++-- .../AvaloniaTest/ViewModels/ViewModelBase.cs | 7 ++-- .../AvaloniaTest/Views/MainView.axaml.cs | 11 +++-- .../AvaloniaTest/Views/MainWindow.axaml.cs | 11 +++-- 25 files changed, 220 insertions(+), 232 deletions(-) diff --git a/templates/csharp/app-mvvm/App.axaml.cs b/templates/csharp/app-mvvm/App.axaml.cs index 6826e992..c90cb7a8 100644 --- a/templates/csharp/app-mvvm/App.axaml.cs +++ b/templates/csharp/app-mvvm/App.axaml.cs @@ -6,29 +6,28 @@ using AvaloniaAppTemplate.ViewModels; using AvaloniaAppTemplate.Views; -namespace AvaloniaAppTemplate +namespace AvaloniaAppTemplate; + +public partial class App : Application { - public partial class App : Application + public override void Initialize() { - public override void Initialize() - { - AvaloniaXamlLoader.Load(this); - } + AvaloniaXamlLoader.Load(this); + } - public override void OnFrameworkInitializationCompleted() + public override void OnFrameworkInitializationCompleted() + { + if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop) { - if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop) + // Line below is needed to remove Avalonia data validation. + // Without this line you will get duplicate validations from both Avalonia and CT + ExpressionObserver.DataValidators.RemoveAll(x => x is DataAnnotationsValidationPlugin); + desktop.MainWindow = new MainWindow { - // Line below is needed to remove Avalonia data validation. - // Without this line you will get duplicate validations from both Avalonia and CT - ExpressionObserver.DataValidators.RemoveAll(x => x is DataAnnotationsValidationPlugin); - desktop.MainWindow = new MainWindow - { - DataContext = new MainWindowViewModel(), - }; - } - - base.OnFrameworkInitializationCompleted(); + DataContext = new MainWindowViewModel(), + }; } + + base.OnFrameworkInitializationCompleted(); } } \ No newline at end of file diff --git a/templates/csharp/app-mvvm/Program.cs b/templates/csharp/app-mvvm/Program.cs index 89023687..8ae2dfb2 100644 --- a/templates/csharp/app-mvvm/Program.cs +++ b/templates/csharp/app-mvvm/Program.cs @@ -4,26 +4,25 @@ #endif using System; -namespace AvaloniaAppTemplate +namespace AvaloniaAppTemplate; + +class Program { - class Program - { - // Initialization code. Don't use any Avalonia, third-party APIs or any - // SynchronizationContext-reliant code before AppMain is called: things aren't initialized - // yet and stuff might break. - [STAThread] - public static void Main(string[] args) => BuildAvaloniaApp() - .StartWithClassicDesktopLifetime(args); + // Initialization code. Don't use any Avalonia, third-party APIs or any + // SynchronizationContext-reliant code before AppMain is called: things aren't initialized + // yet and stuff might break. + [STAThread] + public static void Main(string[] args) => BuildAvaloniaApp() + .StartWithClassicDesktopLifetime(args); - // Avalonia configuration, don't remove; also used by visual designer. - public static AppBuilder BuildAvaloniaApp() - => AppBuilder.Configure() - .UsePlatformDetect() + // Avalonia configuration, don't remove; also used by visual designer. + public static AppBuilder BuildAvaloniaApp() + => AppBuilder.Configure() + .UsePlatformDetect() #if (!ReactiveUIToolkitChosen) - .LogToTrace(); + .LogToTrace(); #else - .LogToTrace() - .UseReactiveUI(); + .LogToTrace() + .UseReactiveUI(); #endif - } } diff --git a/templates/csharp/app-mvvm/ViewLocator.cs b/templates/csharp/app-mvvm/ViewLocator.cs index 712a115c..21eb621f 100644 --- a/templates/csharp/app-mvvm/ViewLocator.cs +++ b/templates/csharp/app-mvvm/ViewLocator.cs @@ -8,31 +8,30 @@ using AvaloniaAppTemplate.ViewModels; #endif -namespace AvaloniaAppTemplate +namespace AvaloniaAppTemplate; + +public class ViewLocator : IDataTemplate { - public class ViewLocator : IDataTemplate + public IControl Build(object data) { - public IControl Build(object data) - { - var name = data.GetType().FullName!.Replace("ViewModel", "View"); - var type = Type.GetType(name); + var name = data.GetType().FullName!.Replace("ViewModel", "View"); + var type = Type.GetType(name); - if (type != null) - { - return (Control)Activator.CreateInstance(type)!; - } - - return new TextBlock { Text = "Not Found: " + name }; + if (type != null) + { + return (Control)Activator.CreateInstance(type)!; } + + return new TextBlock { Text = "Not Found: " + name }; + } - public bool Match(object data) - { + public bool Match(object data) + { #if (ReactiveUIToolkitChosen) - return data is ViewModelBase; + return data is ViewModelBase; #else - return data is INotifyPropertyChanged; + return data is INotifyPropertyChanged; #endif - } } } \ No newline at end of file diff --git a/templates/csharp/app-mvvm/ViewModels/MainWindowViewModel.cs b/templates/csharp/app-mvvm/ViewModels/MainWindowViewModel.cs index ebbb1d68..e7293929 100644 --- a/templates/csharp/app-mvvm/ViewModels/MainWindowViewModel.cs +++ b/templates/csharp/app-mvvm/ViewModels/MainWindowViewModel.cs @@ -1,14 +1,14 @@ #if (!ReactiveUIToolkitChosen) using CommunityToolkit.Mvvm.ComponentModel; #endif -namespace AvaloniaAppTemplate.ViewModels -{ + +namespace AvaloniaAppTemplate.ViewModels; + #if (!ReactiveUIToolkitChosen) - public class MainWindowViewModel : ObservableObject +public class MainWindowViewModel : ObservableObject #else - public class MainWindowViewModel : ViewModelBase +public class MainWindowViewModel : ViewModelBase #endif - { - public string Greeting => "Welcome to Avalonia!"; - } +{ + public string Greeting => "Welcome to Avalonia!"; } diff --git a/templates/csharp/app-mvvm/ViewModels/ViewModelBase.cs b/templates/csharp/app-mvvm/ViewModels/ViewModelBase.cs index af4e9bda..020c5db7 100644 --- a/templates/csharp/app-mvvm/ViewModels/ViewModelBase.cs +++ b/templates/csharp/app-mvvm/ViewModels/ViewModelBase.cs @@ -1,8 +1,7 @@ using ReactiveUI; -namespace AvaloniaAppTemplate.ViewModels +namespace AvaloniaAppTemplate.ViewModels; + +public class ViewModelBase : ReactiveObject { - public class ViewModelBase : ReactiveObject - { - } } diff --git a/templates/csharp/app-mvvm/Views/MainWindow.axaml.cs b/templates/csharp/app-mvvm/Views/MainWindow.axaml.cs index 923b1ec6..5e6ce824 100644 --- a/templates/csharp/app-mvvm/Views/MainWindow.axaml.cs +++ b/templates/csharp/app-mvvm/Views/MainWindow.axaml.cs @@ -1,12 +1,11 @@ using Avalonia.Controls; -namespace AvaloniaAppTemplate.Views +namespace AvaloniaAppTemplate.Views; + +public partial class MainWindow : Window { - public partial class MainWindow : Window + public MainWindow() { - public MainWindow() - { - InitializeComponent(); - } + InitializeComponent(); } } \ No newline at end of file diff --git a/templates/csharp/app/App.axaml.cs b/templates/csharp/app/App.axaml.cs index 93dc1b16..edfe01ee 100644 --- a/templates/csharp/app/App.axaml.cs +++ b/templates/csharp/app/App.axaml.cs @@ -2,23 +2,22 @@ using Avalonia.Controls.ApplicationLifetimes; using Avalonia.Markup.Xaml; -namespace AvaloniaAppTemplate +namespace AvaloniaAppTemplate; + +public partial class App : Application { - public partial class App : Application + public override void Initialize() { - public override void Initialize() - { - AvaloniaXamlLoader.Load(this); - } + AvaloniaXamlLoader.Load(this); + } - public override void OnFrameworkInitializationCompleted() + public override void OnFrameworkInitializationCompleted() + { + if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop) { - if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop) - { - desktop.MainWindow = new MainWindow(); - } - - base.OnFrameworkInitializationCompleted(); + desktop.MainWindow = new MainWindow(); } + + base.OnFrameworkInitializationCompleted(); } } \ No newline at end of file diff --git a/templates/csharp/app/MainWindow.axaml.cs b/templates/csharp/app/MainWindow.axaml.cs index 4c6ef668..55660b3a 100644 --- a/templates/csharp/app/MainWindow.axaml.cs +++ b/templates/csharp/app/MainWindow.axaml.cs @@ -1,12 +1,11 @@ using Avalonia.Controls; -namespace AvaloniaAppTemplate +namespace AvaloniaAppTemplate; + +public partial class MainWindow : Window { - public partial class MainWindow : Window + public MainWindow() { - public MainWindow() - { - InitializeComponent(); - } + InitializeComponent(); } } \ No newline at end of file diff --git a/templates/csharp/app/Program.cs b/templates/csharp/app/Program.cs index 25e090c5..be4383a9 100644 --- a/templates/csharp/app/Program.cs +++ b/templates/csharp/app/Program.cs @@ -1,21 +1,20 @@ using Avalonia; using System; -namespace AvaloniaAppTemplate +namespace AvaloniaAppTemplate; + +class Program { - class Program - { - // Initialization code. Don't use any Avalonia, third-party APIs or any - // SynchronizationContext-reliant code before AppMain is called: things aren't initialized - // yet and stuff might break. - [STAThread] - public static void Main(string[] args) => BuildAvaloniaApp() - .StartWithClassicDesktopLifetime(args); + // Initialization code. Don't use any Avalonia, third-party APIs or any + // SynchronizationContext-reliant code before AppMain is called: things aren't initialized + // yet and stuff might break. + [STAThread] + public static void Main(string[] args) => BuildAvaloniaApp() + .StartWithClassicDesktopLifetime(args); - // Avalonia configuration, don't remove; also used by visual designer. - public static AppBuilder BuildAvaloniaApp() - => AppBuilder.Configure() - .UsePlatformDetect() - .LogToTrace(); - } + // Avalonia configuration, don't remove; also used by visual designer. + public static AppBuilder BuildAvaloniaApp() + => AppBuilder.Configure() + .UsePlatformDetect() + .LogToTrace(); } diff --git a/templates/csharp/templatedcontrol/NewTemplatedControl.axaml.cs b/templates/csharp/templatedcontrol/NewTemplatedControl.axaml.cs index 5d93a58f..b9cf46dc 100644 --- a/templates/csharp/templatedcontrol/NewTemplatedControl.axaml.cs +++ b/templates/csharp/templatedcontrol/NewTemplatedControl.axaml.cs @@ -2,9 +2,8 @@ using Avalonia.Controls; using Avalonia.Controls.Primitives; -namespace AvaloniaAppTemplate.Namespace +namespace AvaloniaAppTemplate.Namespace; + +public class NewTemplatedControl : TemplatedControl { - public class NewTemplatedControl : TemplatedControl - { - } } \ No newline at end of file diff --git a/templates/csharp/usercontrol/NewUserControl.axaml.cs b/templates/csharp/usercontrol/NewUserControl.axaml.cs index ff967526..a416478d 100644 --- a/templates/csharp/usercontrol/NewUserControl.axaml.cs +++ b/templates/csharp/usercontrol/NewUserControl.axaml.cs @@ -2,13 +2,12 @@ using Avalonia.Controls; using Avalonia.Markup.Xaml; -namespace AvaloniaAppTemplate.Namespace +namespace AvaloniaAppTemplate.Namespace; + +public partial class NewUserControl : UserControl { - public partial class NewUserControl : UserControl + public NewUserControl() { - public NewUserControl() - { - InitializeComponent(); - } + InitializeComponent(); } } \ No newline at end of file diff --git a/templates/csharp/window/NewWindow.axaml.cs b/templates/csharp/window/NewWindow.axaml.cs index 19342b48..9fb50caa 100644 --- a/templates/csharp/window/NewWindow.axaml.cs +++ b/templates/csharp/window/NewWindow.axaml.cs @@ -2,13 +2,12 @@ using Avalonia.Controls; using Avalonia.Markup.Xaml; -namespace AvaloniaAppTemplate.Namespace +namespace AvaloniaAppTemplate.Namespace; + +public partial class NewWindow : Window { - public partial class NewWindow : Window + public NewWindow() { - public NewWindow() - { - InitializeComponent(); - } + InitializeComponent(); } } \ No newline at end of file diff --git a/templates/csharp/xplat/AvaloniaTest.Android/MainActivity.cs b/templates/csharp/xplat/AvaloniaTest.Android/MainActivity.cs index 15a64c9b..b611ed98 100644 --- a/templates/csharp/xplat/AvaloniaTest.Android/MainActivity.cs +++ b/templates/csharp/xplat/AvaloniaTest.Android/MainActivity.cs @@ -2,10 +2,9 @@ using Android.Content.PM; using Avalonia.Android; -namespace AvaloniaTest.Android +namespace AvaloniaTest.Android; + +[Activity(Label = "AvaloniaTest.Android", Theme = "@style/MyTheme.NoActionBar", Icon = "@drawable/icon", LaunchMode = LaunchMode.SingleTop, ConfigurationChanges = ConfigChanges.Orientation | ConfigChanges.ScreenSize)] +public class MainActivity : AvaloniaMainActivity { - [Activity(Label = "AvaloniaTest.Android", Theme = "@style/MyTheme.NoActionBar", Icon = "@drawable/icon", LaunchMode = LaunchMode.SingleTop, ConfigurationChanges = ConfigChanges.Orientation | ConfigChanges.ScreenSize)] - public class MainActivity : AvaloniaMainActivity - { - } } diff --git a/templates/csharp/xplat/AvaloniaTest.Android/SplashActivity.cs b/templates/csharp/xplat/AvaloniaTest.Android/SplashActivity.cs index 228b979f..3765f52f 100644 --- a/templates/csharp/xplat/AvaloniaTest.Android/SplashActivity.cs +++ b/templates/csharp/xplat/AvaloniaTest.Android/SplashActivity.cs @@ -4,27 +4,28 @@ using Application = Android.App.Application; using Avalonia; using Avalonia.Android; +using Avalonia.ReactiveUI; -namespace AvaloniaTest.Android +namespace AvaloniaTest.Android; + +[Activity(Theme = "@style/MyTheme.Splash", MainLauncher = true, NoHistory = true)] +public class SplashActivity : AvaloniaSplashActivity { - [Activity(Theme = "@style/MyTheme.Splash", MainLauncher = true, NoHistory = true)] - public class SplashActivity : AvaloniaSplashActivity + protected override AppBuilder CustomizeAppBuilder(AppBuilder builder) { - protected override AppBuilder CustomizeAppBuilder(AppBuilder builder) - { - return base.CustomizeAppBuilder(builder); - } + return base.CustomizeAppBuilder(builder) + .UseReactiveUI(); + } - protected override void OnCreate(Bundle? savedInstanceState) - { - base.OnCreate(savedInstanceState); - } + protected override void OnCreate(Bundle? savedInstanceState) + { + base.OnCreate(savedInstanceState); + } - protected override void OnResume() - { - base.OnResume(); + protected override void OnResume() + { + base.OnResume(); - StartActivity(new Intent(Application.Context, typeof(MainActivity))); - } + StartActivity(new Intent(Application.Context, typeof(MainActivity))); } } diff --git a/templates/csharp/xplat/AvaloniaTest.Desktop/Program.cs b/templates/csharp/xplat/AvaloniaTest.Desktop/Program.cs index eb1b08b4..77941a49 100644 --- a/templates/csharp/xplat/AvaloniaTest.Desktop/Program.cs +++ b/templates/csharp/xplat/AvaloniaTest.Desktop/Program.cs @@ -1,22 +1,22 @@ using System; using Avalonia; +using Avalonia.ReactiveUI; -namespace AvaloniaTest.Desktop +namespace AvaloniaTest.Desktop; + +class Program { - class Program - { - // Initialization code. Don't use any Avalonia, third-party APIs or any - // SynchronizationContext-reliant code before AppMain is called: things aren't initialized - // yet and stuff might break. - [STAThread] - public static void Main(string[] args) => BuildAvaloniaApp() - .StartWithClassicDesktopLifetime(args); + // Initialization code. Don't use any Avalonia, third-party APIs or any + // SynchronizationContext-reliant code before AppMain is called: things aren't initialized + // yet and stuff might break. + [STAThread] + public static void Main(string[] args) => BuildAvaloniaApp() + .StartWithClassicDesktopLifetime(args); - // Avalonia configuration, don't remove; also used by visual designer. - public static AppBuilder BuildAvaloniaApp() - => AppBuilder.Configure() - .UsePlatformDetect() - .LogToTrace() - .UseReactiveUI(); - } + // Avalonia configuration, don't remove; also used by visual designer. + public static AppBuilder BuildAvaloniaApp() + => AppBuilder.Configure() + .UsePlatformDetect() + .LogToTrace() + .UseReactiveUI(); } diff --git a/templates/csharp/xplat/AvaloniaTest.Web/Program.cs b/templates/csharp/xplat/AvaloniaTest.Web/Program.cs index 9c1524c3..974283b5 100644 --- a/templates/csharp/xplat/AvaloniaTest.Web/Program.cs +++ b/templates/csharp/xplat/AvaloniaTest.Web/Program.cs @@ -1,6 +1,7 @@ using System.Runtime.Versioning; using Avalonia; using Avalonia.Web; +using Avalonia.ReactiveUI; using AvaloniaTest; [assembly: SupportedOSPlatform("browser")] @@ -8,6 +9,7 @@ internal partial class Program { private static void Main(string[] args) => BuildAvaloniaApp() + .UseReactiveUI() .SetupBrowserApp("out"); public static AppBuilder BuildAvaloniaApp() diff --git a/templates/csharp/xplat/AvaloniaTest.iOS/AppDelegate.cs b/templates/csharp/xplat/AvaloniaTest.iOS/AppDelegate.cs index 045f65c4..a448e9a0 100644 --- a/templates/csharp/xplat/AvaloniaTest.iOS/AppDelegate.cs +++ b/templates/csharp/xplat/AvaloniaTest.iOS/AppDelegate.cs @@ -4,15 +4,18 @@ using Avalonia.Controls; using Avalonia.iOS; using Avalonia.Media; +using Avalonia.ReactiveUI; -namespace AvaloniaTest.iOS +namespace AvaloniaTest.iOS; + +// The UIApplicationDelegate for the application. This class is responsible for launching the +// User Interface of the application, as well as listening (and optionally responding) to +// application events from iOS. +[Register("AppDelegate")] +public partial class AppDelegate : AvaloniaAppDelegate { - // The UIApplicationDelegate for the application. This class is responsible for launching the - // User Interface of the application, as well as listening (and optionally responding) to - // application events from iOS. - [Register("AppDelegate")] - public partial class AppDelegate : AvaloniaAppDelegate + protected override AppBuilder CustomizeAppBuilder(AppBuilder builder) { - + return builder.UseReactiveUI(); } } diff --git a/templates/csharp/xplat/AvaloniaTest.iOS/Main.cs b/templates/csharp/xplat/AvaloniaTest.iOS/Main.cs index 6e975ef4..cfb5770b 100644 --- a/templates/csharp/xplat/AvaloniaTest.iOS/Main.cs +++ b/templates/csharp/xplat/AvaloniaTest.iOS/Main.cs @@ -1,15 +1,14 @@ using UIKit; -namespace AvaloniaTest.iOS +namespace AvaloniaTest.iOS; + +public class Application { - public class Application + // This is the main entry point of the application. + static void Main(string[] args) { - // This is the main entry point of the application. - static void Main(string[] args) - { - // if you want to use a different Application Delegate class from "AppDelegate" - // you can specify it here. - UIApplication.Main(args, null, typeof(AppDelegate)); - } + // if you want to use a different Application Delegate class from "AppDelegate" + // you can specify it here. + UIApplication.Main(args, null, typeof(AppDelegate)); } } diff --git a/templates/csharp/xplat/AvaloniaTest/App.axaml.cs b/templates/csharp/xplat/AvaloniaTest/App.axaml.cs index c60186c0..5530a141 100644 --- a/templates/csharp/xplat/AvaloniaTest/App.axaml.cs +++ b/templates/csharp/xplat/AvaloniaTest/App.axaml.cs @@ -4,33 +4,32 @@ using AvaloniaTest.ViewModels; using AvaloniaTest.Views; -namespace AvaloniaTest +namespace AvaloniaTest; + +public partial class App : Application { - public partial class App : Application + public override void Initialize() { - public override void Initialize() - { - AvaloniaXamlLoader.Load(this); - } + AvaloniaXamlLoader.Load(this); + } - public override void OnFrameworkInitializationCompleted() + public override void OnFrameworkInitializationCompleted() + { + if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop) { - if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop) + desktop.MainWindow = new MainWindow { - desktop.MainWindow = new MainWindow - { - DataContext = new MainViewModel() - }; - } - else if (ApplicationLifetime is ISingleViewApplicationLifetime singleViewPlatform) + DataContext = new MainViewModel() + }; + } + else if (ApplicationLifetime is ISingleViewApplicationLifetime singleViewPlatform) + { + singleViewPlatform.MainView = new MainView { - singleViewPlatform.MainView = new MainView - { - DataContext = new MainViewModel() - }; - } - - base.OnFrameworkInitializationCompleted(); + DataContext = new MainViewModel() + }; } + + base.OnFrameworkInitializationCompleted(); } } \ No newline at end of file diff --git a/templates/csharp/xplat/AvaloniaTest/AvaloniaTest.csproj b/templates/csharp/xplat/AvaloniaTest/AvaloniaTest.csproj index f8ee991a..9ea7e691 100644 --- a/templates/csharp/xplat/AvaloniaTest/AvaloniaTest.csproj +++ b/templates/csharp/xplat/AvaloniaTest/AvaloniaTest.csproj @@ -13,6 +13,7 @@ + diff --git a/templates/csharp/xplat/AvaloniaTest/ViewLocator.cs b/templates/csharp/xplat/AvaloniaTest/ViewLocator.cs index b5e44450..61508f43 100644 --- a/templates/csharp/xplat/AvaloniaTest/ViewLocator.cs +++ b/templates/csharp/xplat/AvaloniaTest/ViewLocator.cs @@ -3,29 +3,28 @@ using Avalonia.Controls.Templates; using AvaloniaTest.ViewModels; -namespace AvaloniaTest +namespace AvaloniaTest; + +public class ViewLocator : IDataTemplate { - public class ViewLocator : IDataTemplate + public IControl? Build(object? data) { - public IControl? Build(object? data) - { - if (data is null) - return null; + if (data is null) + return null; - var name = data.GetType().FullName!.Replace("ViewModel", "View"); - var type = Type.GetType(name); - - if (type != null) - { - return (Control)Activator.CreateInstance(type)!; - } - - return new TextBlock { Text = name }; - } + var name = data.GetType().FullName!.Replace("ViewModel", "View"); + var type = Type.GetType(name); - public bool Match(object? data) + if (type != null) { - return data is ViewModelBase; + return (Control)Activator.CreateInstance(type)!; } + + return new TextBlock { Text = name }; + } + + public bool Match(object? data) + { + return data is ViewModelBase; } } \ No newline at end of file diff --git a/templates/csharp/xplat/AvaloniaTest/ViewModels/MainViewModel.cs b/templates/csharp/xplat/AvaloniaTest/ViewModels/MainViewModel.cs index 4a8d7af2..fe9abfd8 100644 --- a/templates/csharp/xplat/AvaloniaTest/ViewModels/MainViewModel.cs +++ b/templates/csharp/xplat/AvaloniaTest/ViewModels/MainViewModel.cs @@ -1,7 +1,6 @@ -namespace AvaloniaTest.ViewModels +namespace AvaloniaTest.ViewModels; + +public class MainViewModel : ViewModelBase { - public class MainViewModel : ViewModelBase - { - public string Greeting => "Welcome to Avalonia!"; - } + public string Greeting => "Welcome to Avalonia!"; } diff --git a/templates/csharp/xplat/AvaloniaTest/ViewModels/ViewModelBase.cs b/templates/csharp/xplat/AvaloniaTest/ViewModels/ViewModelBase.cs index 98120261..3b1a38de 100644 --- a/templates/csharp/xplat/AvaloniaTest/ViewModels/ViewModelBase.cs +++ b/templates/csharp/xplat/AvaloniaTest/ViewModels/ViewModelBase.cs @@ -1,8 +1,7 @@ using ReactiveUI; -namespace AvaloniaTest.ViewModels +namespace AvaloniaTest.ViewModels; + +public class ViewModelBase : ReactiveObject { - public class ViewModelBase : ReactiveObject - { - } } diff --git a/templates/csharp/xplat/AvaloniaTest/Views/MainView.axaml.cs b/templates/csharp/xplat/AvaloniaTest/Views/MainView.axaml.cs index 5ebe97c7..7dd6596c 100644 --- a/templates/csharp/xplat/AvaloniaTest/Views/MainView.axaml.cs +++ b/templates/csharp/xplat/AvaloniaTest/Views/MainView.axaml.cs @@ -1,12 +1,11 @@ using Avalonia.Controls; -namespace AvaloniaTest.Views +namespace AvaloniaTest.Views; + +public partial class MainView : UserControl { - public partial class MainView : UserControl + public MainView() { - public MainView() - { - InitializeComponent(); - } + InitializeComponent(); } } \ No newline at end of file diff --git a/templates/csharp/xplat/AvaloniaTest/Views/MainWindow.axaml.cs b/templates/csharp/xplat/AvaloniaTest/Views/MainWindow.axaml.cs index 96735c57..2a1dd424 100644 --- a/templates/csharp/xplat/AvaloniaTest/Views/MainWindow.axaml.cs +++ b/templates/csharp/xplat/AvaloniaTest/Views/MainWindow.axaml.cs @@ -1,12 +1,11 @@ using Avalonia.Controls; -namespace AvaloniaTest.Views +namespace AvaloniaTest.Views; + +public partial class MainWindow : Window { - public partial class MainWindow : Window + public MainWindow() { - public MainWindow() - { - InitializeComponent(); - } + InitializeComponent(); } } \ No newline at end of file From 2b4a8876863744257619e13e12323ee19502a36e Mon Sep 17 00:00:00 2001 From: Maksym Katsydan Date: Mon, 14 Nov 2022 18:02:00 -0500 Subject: [PATCH 4/8] Update splash screen styles for the Web --- .../xplat/AvaloniaTest.Web/AppBundle/app.css | 160 ++++-------------- .../AvaloniaTest.Web/AppBundle/index.html | 5 +- 2 files changed, 39 insertions(+), 126 deletions(-) diff --git a/templates/csharp/xplat/AvaloniaTest.Web/AppBundle/app.css b/templates/csharp/xplat/AvaloniaTest.Web/AppBundle/app.css index a83e9fd3..027ea8f7 100644 --- a/templates/csharp/xplat/AvaloniaTest.Web/AppBundle/app.css +++ b/templates/csharp/xplat/AvaloniaTest.Web/AppBundle/app.css @@ -1,49 +1,58 @@ /* HTML styles for the splash screen */ -.center { - display: flex; - justify-content: center; - align-items: center; - height: 100vh; +.highlight { + color: white; + font-size: 2.5rem; + display: block; } -#avalonia-splash { +.purple { + color: #8b44ac; +} + +.icon { + opacity: 0.05; + height: 35%; + width: 35%; position: absolute; - height: 100%; - width: 100%; - background: radial-gradient(#16A757, #116336); - justify-content: center; - align-items: center; + background-repeat: no-repeat; + right: 0px; + bottom: 0px; + margin-right: 3%; + margin-bottom: 5%; + z-index: 5000; + background-position: right bottom; + pointer-events: none; } -.splash-close { - animation: fadeout 0.3s linear forwards; +#avalonia-splash a { + color: whitesmoke; + text-decoration: none; } -.spinner-container { +.center { display: flex; - position: absolute; - height: 100%; - width: 100%; justify-content: center; align-items: center; - animation: delayedFadeIn 4s linear both; - background: transparent; + height: 100vh; } -.noise-container { - opacity: 70%; - position: absolute; +#avalonia-splash { + position: relative; height: 100%; width: 100%; - overflow: hidden; + color: whitesmoke; + background: #1b2a4e; + font-family: 'Nunito', sans-serif; + background-position: center; + background-size: cover; + background-repeat: no-repeat; + justify-content: center; + align-items: center; } -#out { - position: absolute; - height: 100%; - width: 100%; - z-index: 1; +.splash-close { + animation: fadeout 0.25s linear forwards; } @keyframes fadeout { @@ -54,100 +63,5 @@ 100% { opacity: 0; visibility: collapse; - left: 100%; - } -} - -@keyframes delayedFadeIn { - 0% { - visibility: collapse; - } - - 99% { - visibility: collapse; - } - - 100% { - visibility: visible; - } -} - -.loader { - animation: rotate 1s infinite; - height: 50px; - width: 50px; -} - -.loader:before, .loader:after { - border-radius: 50%; - content: ''; - display: block; - height: 20px; - width: 20px; -} - -.loader:before { - animation: ball1 1s infinite; - background-color: white; - box-shadow: 30px 0 0 white; - margin-bottom: 10px; -} - -.loader:after { - animation: ball2 1s infinite; - background-color: white; - box-shadow: 30px 0 0 white; -} - -@keyframes rotate { - 0% { - -webkit-transform: rotate(0deg) scale(0.8); - -moz-transform: rotate(0deg) scale(0.8); - } - - 50% { - -webkit-transform: rotate(360deg) scale(1.2); - -moz-transform: rotate(360deg) scale(1.2); - } - - 100% { - -webkit-transform: rotate(720deg) scale(0.8); - -moz-transform: rotate(720deg) scale(0.8); - } -} - -@keyframes ball1 { - 0% { - box-shadow: 30px 0 0 white; - } - - 50% { - box-shadow: 0 0 0 white; - margin-bottom: 0; - -webkit-transform: translate(15px,15px); - -moz-transform: translate(15px, 15px); - } - - 100% { - box-shadow: 30px 0 0 white; - margin-bottom: 10px; - } -} - -@keyframes ball2 { - 0% { - box-shadow: 30px 0 0 white; - } - - 50% { - box-shadow: 0 0 0 white; - margin-top: -20px; - -webkit-transform: translate(15px,15px); - -moz-transform: translate(15px, 15px); - } - - 100% { - box-shadow: 30px 0 0 white; - margin-top: 0; } } diff --git a/templates/csharp/xplat/AvaloniaTest.Web/AppBundle/index.html b/templates/csharp/xplat/AvaloniaTest.Web/AppBundle/index.html index e5b247b6..81aa56ef 100644 --- a/templates/csharp/xplat/AvaloniaTest.Web/AppBundle/index.html +++ b/templates/csharp/xplat/AvaloniaTest.Web/AppBundle/index.html @@ -13,10 +13,8 @@ - - +
- Avalonia Logo

@@ -24,6 +22,7 @@

Avalonia UI

+ Avalonia Logo
From abb756bf0befe5336ffef70beb28475f23121c12 Mon Sep 17 00:00:00 2001 From: Maksym Katsydan Date: Mon, 14 Nov 2022 18:02:10 -0500 Subject: [PATCH 5/8] Fix tests build --- azure-pipelines.yml | 2 +- tests/build-test.ps1 | 22 +++++++++++++--------- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 44d3f0d9..d2ff6038 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -16,7 +16,7 @@ steps: - task: CmdLine@2 displayName: 'Install templates' inputs: - script: 'dotnet new -i $(Build.ArtifactStagingDirectory)/NuGet/*.nupkg' + script: 'dotnet new install $(Build.ArtifactStagingDirectory)/NuGet/*.nupkg' - task: CmdLine@2 displayName: 'Install workload' inputs: diff --git a/tests/build-test.ps1 b/tests/build-test.ps1 index b6942030..ce9c4c62 100644 --- a/tests/build-test.ps1 +++ b/tests/build-test.ps1 @@ -31,28 +31,32 @@ function Test-Template { [Parameter(Position=2,Mandatory=1)][string]$lang ) + $outDir = [IO.Path]::GetFullPath([IO.Path]::Combine($pwd, ".\output")) + # Create the project - Exec { dotnet new $template -o output/$lang/$name -lang $lang } + Exec { dotnet new $template -o $outDir/$lang/$name -lang $lang } # Instantiate each item template in the project - Exec { dotnet new avalonia.resource -o output/$lang/$name -n NewResourceDictionary } - Exec { dotnet new avalonia.styles -o output/$lang/$name -n NewStyles } - Exec { dotnet new avalonia.usercontrol -o output/$lang/$name -na $name -n NewUserControl -lang $lang } - Exec { dotnet new avalonia.window -o output/$lang/$name -na $name -n NewWindow -lang $lang } + Exec { dotnet new avalonia.resource -o $outDir/$lang/$name -n NewResourceDictionary } + Exec { dotnet new avalonia.styles -o $outDir/$lang/$name -n NewStyles } + Exec { dotnet new avalonia.usercontrol -o $outDir/$lang/$name -n NewUserControl -lang $lang } + Exec { dotnet new avalonia.window -o $outDir/$lang/$name -n NewWindow -lang $lang } If($lang -eq "F#") { - [xml]$doc = Get-Content .\output\$lang\$name\$name.fsproj + $fsprojPath = [IO.Path]::Combine($outDir, $lang, $name, $name + '.fsproj') + + [xml]$doc = Get-Content $fsprojPath $item = $doc.CreateElement('Compile') $item.SetAttribute('Include', 'NewUserControl.axaml.fs') $doc.Project.ItemGroup[0].PrependChild($item) $item = $doc.CreateElement('Compile') $item.SetAttribute('Include', 'NewWindow.axaml.fs') $doc.Project.ItemGroup[0].PrependChild($item) - $doc.Save([IO.Path]::GetFullPath("./output/$lang/$name/$name.fsproj")) + $doc.Save($fsprojPath) } # Build - Exec { dotnet build -warnaserror output/$lang/$name } + Exec { dotnet build output/$lang/$name } } function Create-And-Build { @@ -66,7 +70,7 @@ function Create-And-Build { Exec { dotnet new $template -o output/$lang/$name -lang $lang } # Build - Exec { dotnet build -warnaserror output/$lang/$name } + Exec { dotnet build output/$lang/$name } } if (Test-Path "output") { From dc391df6f2f5a395b7178a562d6b943742ccd2c3 Mon Sep 17 00:00:00 2001 From: Maksym Katsydan Date: Mon, 14 Nov 2022 18:18:30 -0500 Subject: [PATCH 6/8] Add remaining app.manifests --- .../csharp/app-mvvm/AvaloniaAppTemplate.csproj | 1 + templates/csharp/app-mvvm/app.manifest | 18 ++++++++++++++++++ .../csharp/app/AvaloniaAppTemplate.csproj | 1 + templates/csharp/app/app.manifest | 18 ++++++++++++++++++ .../fsharp/app-mvvm/AvaloniaAppTemplate.fsproj | 1 + templates/fsharp/app-mvvm/app.manifest | 18 ++++++++++++++++++ .../fsharp/app/AvaloniaAppTemplate.fsproj | 1 + templates/fsharp/app/app.manifest | 18 ++++++++++++++++++ 8 files changed, 76 insertions(+) create mode 100644 templates/csharp/app-mvvm/app.manifest create mode 100644 templates/csharp/app/app.manifest create mode 100644 templates/fsharp/app-mvvm/app.manifest create mode 100644 templates/fsharp/app/app.manifest diff --git a/templates/csharp/app-mvvm/AvaloniaAppTemplate.csproj b/templates/csharp/app-mvvm/AvaloniaAppTemplate.csproj index 05616939..270551d9 100644 --- a/templates/csharp/app-mvvm/AvaloniaAppTemplate.csproj +++ b/templates/csharp/app-mvvm/AvaloniaAppTemplate.csproj @@ -4,6 +4,7 @@ net6.0 enable true + app.manifest
diff --git a/templates/csharp/app-mvvm/app.manifest b/templates/csharp/app-mvvm/app.manifest new file mode 100644 index 00000000..dfdb7d3e --- /dev/null +++ b/templates/csharp/app-mvvm/app.manifest @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + diff --git a/templates/csharp/app/AvaloniaAppTemplate.csproj b/templates/csharp/app/AvaloniaAppTemplate.csproj index f1b4fd22..f511eb66 100644 --- a/templates/csharp/app/AvaloniaAppTemplate.csproj +++ b/templates/csharp/app/AvaloniaAppTemplate.csproj @@ -4,6 +4,7 @@ net6.0 enable true + app.manifest
diff --git a/templates/csharp/app/app.manifest b/templates/csharp/app/app.manifest new file mode 100644 index 00000000..dfdb7d3e --- /dev/null +++ b/templates/csharp/app/app.manifest @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + diff --git a/templates/fsharp/app-mvvm/AvaloniaAppTemplate.fsproj b/templates/fsharp/app-mvvm/AvaloniaAppTemplate.fsproj index aee035bd..befc547e 100644 --- a/templates/fsharp/app-mvvm/AvaloniaAppTemplate.fsproj +++ b/templates/fsharp/app-mvvm/AvaloniaAppTemplate.fsproj @@ -3,6 +3,7 @@ WinExe net6.0 true + app.manifest
diff --git a/templates/fsharp/app-mvvm/app.manifest b/templates/fsharp/app-mvvm/app.manifest new file mode 100644 index 00000000..dfdb7d3e --- /dev/null +++ b/templates/fsharp/app-mvvm/app.manifest @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + diff --git a/templates/fsharp/app/AvaloniaAppTemplate.fsproj b/templates/fsharp/app/AvaloniaAppTemplate.fsproj index 45083dcc..b93a472a 100644 --- a/templates/fsharp/app/AvaloniaAppTemplate.fsproj +++ b/templates/fsharp/app/AvaloniaAppTemplate.fsproj @@ -3,6 +3,7 @@ WinExe net6.0 true + app.manifest diff --git a/templates/fsharp/app/app.manifest b/templates/fsharp/app/app.manifest new file mode 100644 index 00000000..dfdb7d3e --- /dev/null +++ b/templates/fsharp/app/app.manifest @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + From 8d87ec929560a8b927099ad96b3603542fd7633b Mon Sep 17 00:00:00 2001 From: Maksym Katsydan Date: Mon, 14 Nov 2022 18:18:35 -0500 Subject: [PATCH 7/8] Up the version --- Avalonia.Templates.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Avalonia.Templates.csproj b/Avalonia.Templates.csproj index 8edd0749..1490bea8 100644 --- a/Avalonia.Templates.csproj +++ b/Avalonia.Templates.csproj @@ -2,7 +2,7 @@ Template - 0.10.18.1 + 0.10.18.2 Avalonia.Templates Avalonia Templates Templates for creating Avalonia applications and libraries. From 32cedf827893268fe812d0b4315627fd25cc6bb9 Mon Sep 17 00:00:00 2001 From: Maksym Katsydan Date: Mon, 14 Nov 2022 18:20:35 -0500 Subject: [PATCH 8/8] Fix test --- tests/build-test.ps1 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/build-test.ps1 b/tests/build-test.ps1 index ce9c4c62..b6604bd8 100644 --- a/tests/build-test.ps1 +++ b/tests/build-test.ps1 @@ -31,7 +31,7 @@ function Test-Template { [Parameter(Position=2,Mandatory=1)][string]$lang ) - $outDir = [IO.Path]::GetFullPath([IO.Path]::Combine($pwd, ".\output")) + $outDir = [IO.Path]::GetFullPath([IO.Path]::Combine($pwd, "..", "output")) # Create the project Exec { dotnet new $template -o $outDir/$lang/$name -lang $lang } @@ -56,7 +56,7 @@ function Test-Template { } # Build - Exec { dotnet build output/$lang/$name } + Exec { dotnet build $outDir/$lang/$name } } function Create-And-Build {