From fdab8fa64089102b397fe917c238996e28d30ff1 Mon Sep 17 00:00:00 2001 From: Max Katz Date: Thu, 14 Nov 2024 18:30:43 -0800 Subject: [PATCH 1/5] Move Nullable=enable from directory.builds.props --- .../xplat/AvaloniaTest.Browser/AvaloniaTest.Browser.csproj | 1 + templates/csharp/xplat/Directory.Build.props | 1 - templates/fsharp/xplat/AvaloniaTest.iOS/AvaloniaTest.iOS.fsproj | 1 - templates/fsharp/xplat/AvaloniaTest/AvaloniaTest.fsproj | 1 - 4 files changed, 1 insertion(+), 3 deletions(-) diff --git a/templates/csharp/xplat/AvaloniaTest.Browser/AvaloniaTest.Browser.csproj b/templates/csharp/xplat/AvaloniaTest.Browser/AvaloniaTest.Browser.csproj index efb973e0..e4db4280 100644 --- a/templates/csharp/xplat/AvaloniaTest.Browser/AvaloniaTest.Browser.csproj +++ b/templates/csharp/xplat/AvaloniaTest.Browser/AvaloniaTest.Browser.csproj @@ -3,6 +3,7 @@ FrameworkParameter-browser Exe true + enable diff --git a/templates/csharp/xplat/Directory.Build.props b/templates/csharp/xplat/Directory.Build.props index 0f5a6aa2..d12c174d 100644 --- a/templates/csharp/xplat/Directory.Build.props +++ b/templates/csharp/xplat/Directory.Build.props @@ -1,6 +1,5 @@ - enable AvaloniaVersionTemplateParameter diff --git a/templates/fsharp/xplat/AvaloniaTest.iOS/AvaloniaTest.iOS.fsproj b/templates/fsharp/xplat/AvaloniaTest.iOS/AvaloniaTest.iOS.fsproj index f58c4d07..e886b4d9 100644 --- a/templates/fsharp/xplat/AvaloniaTest.iOS/AvaloniaTest.iOS.fsproj +++ b/templates/fsharp/xplat/AvaloniaTest.iOS/AvaloniaTest.iOS.fsproj @@ -4,7 +4,6 @@ FrameworkParameter-ios 13.0 manual - enable iossimulator-x64 diff --git a/templates/fsharp/xplat/AvaloniaTest/AvaloniaTest.fsproj b/templates/fsharp/xplat/AvaloniaTest/AvaloniaTest.fsproj index 941ea97a..b4aeea25 100644 --- a/templates/fsharp/xplat/AvaloniaTest/AvaloniaTest.fsproj +++ b/templates/fsharp/xplat/AvaloniaTest/AvaloniaTest.fsproj @@ -1,7 +1,6 @@  FrameworkParameter - enable latest true From 02ff8460591005ae49b5f51c6cdbe8df21ef06a6 Mon Sep 17 00:00:00 2001 From: Max Katz Date: Thu, 14 Nov 2024 19:11:47 -0800 Subject: [PATCH 2/5] Add UseCentralPackageManagement parameter --- .../.template.config/dotnetcli.host.json | 4 ++++ .../xplat/.template.config/ide.host.json | 7 ++++++ .../xplat/.template.config/template.json | 19 +++++++++++++++ .../AvaloniaTest.Android.csproj | 5 ++++ .../AvaloniaTest.Browser.csproj | 4 ++++ .../AvaloniaTest.Desktop.csproj | 11 ++++++++- .../AvaloniaTest.iOS/AvaloniaTest.iOS.csproj | 4 ++++ .../xplat/AvaloniaTest/AvaloniaTest.csproj | 20 ++++++++++++++-- .../csharp/xplat/Directory.Packages.props | 23 +++++++++++++++++++ .../AvaloniaTest.Desktop.fsproj | 2 +- .../xplat/AvaloniaTest/AvaloniaTest.fsproj | 2 +- tests/build-test.ps1 | 3 +++ 12 files changed, 99 insertions(+), 5 deletions(-) create mode 100644 templates/csharp/xplat/Directory.Packages.props diff --git a/templates/csharp/xplat/.template.config/dotnetcli.host.json b/templates/csharp/xplat/.template.config/dotnetcli.host.json index b4e57786..563cb73f 100644 --- a/templates/csharp/xplat/.template.config/dotnetcli.host.json +++ b/templates/csharp/xplat/.template.config/dotnetcli.host.json @@ -15,6 +15,10 @@ }, "RemoveViewLocator": { "longName": "remove-view-locator" + }, + "UseCentralPackageManagement": { + "longName": "cpm", + "shortName": "cpm" } }, "usageExamples": [ diff --git a/templates/csharp/xplat/.template.config/ide.host.json b/templates/csharp/xplat/.template.config/ide.host.json index 4774aa44..b791f94e 100644 --- a/templates/csharp/xplat/.template.config/ide.host.json +++ b/templates/csharp/xplat/.template.config/ide.host.json @@ -29,6 +29,13 @@ "text": "Remove View Locator" }, "isVisible": true + }, + { + "id": "UseCentralPackageManagement", + "name": { + "text": "Use Central Package Management (CPM)" + }, + "isVisible": true } ] } \ No newline at end of file diff --git a/templates/csharp/xplat/.template.config/template.json b/templates/csharp/xplat/.template.config/template.json index a888cc62..aff3d8d6 100644 --- a/templates/csharp/xplat/.template.config/template.json +++ b/templates/csharp/xplat/.template.config/template.json @@ -77,6 +77,13 @@ "displayName": "Remove Avalonia ViewLocator", "defaultValue": "false" }, + "UseCentralPackageManagement": { + "type": "parameter", + "description": "Defines if your app will Central Package Management (CPM). If disabled, Directory.Build.props will be created with shared Avalonia version.", + "datatype": "bool", + "displayName": "Use Central Package Management (CPM)", + "defaultValue": "true" + }, "HostIdentifier": { "type": "bind", "binding": "HostIdentifier" @@ -100,6 +107,18 @@ "exclude": [ "AvaloniaTest/App.RemoveViewLocator.axaml" ] + }, + { + "condition": "(UseCentralPackageManagement)", + "exclude": [ + "Directory.Build.props" + ] + }, + { + "condition": "(!UseCentralPackageManagement)", + "exclude": [ + "Directory.Packages.props" + ] } ] } diff --git a/templates/csharp/xplat/AvaloniaTest.Android/AvaloniaTest.Android.csproj b/templates/csharp/xplat/AvaloniaTest.Android/AvaloniaTest.Android.csproj index a994825c..2821af20 100644 --- a/templates/csharp/xplat/AvaloniaTest.Android/AvaloniaTest.Android.csproj +++ b/templates/csharp/xplat/AvaloniaTest.Android/AvaloniaTest.Android.csproj @@ -18,8 +18,13 @@ + + + + + diff --git a/templates/csharp/xplat/AvaloniaTest.Browser/AvaloniaTest.Browser.csproj b/templates/csharp/xplat/AvaloniaTest.Browser/AvaloniaTest.Browser.csproj index e4db4280..18aa3a7b 100644 --- a/templates/csharp/xplat/AvaloniaTest.Browser/AvaloniaTest.Browser.csproj +++ b/templates/csharp/xplat/AvaloniaTest.Browser/AvaloniaTest.Browser.csproj @@ -7,7 +7,11 @@ + + + + diff --git a/templates/csharp/xplat/AvaloniaTest.Desktop/AvaloniaTest.Desktop.csproj b/templates/csharp/xplat/AvaloniaTest.Desktop/AvaloniaTest.Desktop.csproj index 78579723..1a1ed3c1 100644 --- a/templates/csharp/xplat/AvaloniaTest.Desktop/AvaloniaTest.Desktop.csproj +++ b/templates/csharp/xplat/AvaloniaTest.Desktop/AvaloniaTest.Desktop.csproj @@ -13,12 +13,21 @@ + + + + + None + All + + - + None All + diff --git a/templates/csharp/xplat/AvaloniaTest.iOS/AvaloniaTest.iOS.csproj b/templates/csharp/xplat/AvaloniaTest.iOS/AvaloniaTest.iOS.csproj index b9b41254..512325b8 100644 --- a/templates/csharp/xplat/AvaloniaTest.iOS/AvaloniaTest.iOS.csproj +++ b/templates/csharp/xplat/AvaloniaTest.iOS/AvaloniaTest.iOS.csproj @@ -7,7 +7,11 @@ + + + + diff --git a/templates/csharp/xplat/AvaloniaTest/AvaloniaTest.csproj b/templates/csharp/xplat/AvaloniaTest/AvaloniaTest.csproj index beaeb658..128cc196 100644 --- a/templates/csharp/xplat/AvaloniaTest/AvaloniaTest.csproj +++ b/templates/csharp/xplat/AvaloniaTest/AvaloniaTest.csproj @@ -13,11 +13,26 @@ + + + + + + + None + All + + + + + + + - + - + None All @@ -26,5 +41,6 @@ + diff --git a/templates/csharp/xplat/Directory.Packages.props b/templates/csharp/xplat/Directory.Packages.props new file mode 100644 index 00000000..7950431c --- /dev/null +++ b/templates/csharp/xplat/Directory.Packages.props @@ -0,0 +1,23 @@ + + + + true + 11.1.0 + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/templates/fsharp/xplat/AvaloniaTest.Desktop/AvaloniaTest.Desktop.fsproj b/templates/fsharp/xplat/AvaloniaTest.Desktop/AvaloniaTest.Desktop.fsproj index 7d0abd20..35a21894 100644 --- a/templates/fsharp/xplat/AvaloniaTest.Desktop/AvaloniaTest.Desktop.fsproj +++ b/templates/fsharp/xplat/AvaloniaTest.Desktop/AvaloniaTest.Desktop.fsproj @@ -18,7 +18,7 @@ - + None All diff --git a/templates/fsharp/xplat/AvaloniaTest/AvaloniaTest.fsproj b/templates/fsharp/xplat/AvaloniaTest/AvaloniaTest.fsproj index b4aeea25..e2ca5c96 100644 --- a/templates/fsharp/xplat/AvaloniaTest/AvaloniaTest.fsproj +++ b/templates/fsharp/xplat/AvaloniaTest/AvaloniaTest.fsproj @@ -27,7 +27,7 @@ - + None All diff --git a/tests/build-test.ps1 b/tests/build-test.ps1 index d520fb1a..e2200a56 100644 --- a/tests/build-test.ps1 +++ b/tests/build-test.ps1 @@ -130,7 +130,10 @@ Create-And-Build "avalonia.mvvm" "AvaloniaMvvm" "C#" "cb" "false" $binlog Create-And-Build "avalonia.mvvm" "AvaloniaMvvm" "C#" "rvl" "true" $binlog Create-And-Build "avalonia.mvvm" "AvaloniaMvvm" "C#" "rvl" "false" $binlog +Create-And-Build "avalonia.xplat" "AvaloniaXplat" "C#" "f" "net8.0" $binlog Create-And-Build "avalonia.xplat" "AvaloniaXplat" "C#" "f" "net9.0" $binlog +Create-And-Build "avalonia.xplat" "AvaloniaXplat" "C#" "cpm" "true" $binlog +Create-And-Build "avalonia.xplat" "AvaloniaXplat" "C#" "cpm" "false" $binlog Create-And-Build "avalonia.xplat" "AvaloniaXplat" "C#" "av" "11.2.1" $binlog Create-And-Build "avalonia.xplat" "AvaloniaXplat" "C#" "m" "ReactiveUI" $binlog Create-And-Build "avalonia.xplat" "AvaloniaXplat" "C#" "m" "CommunityToolkit" $binlog From 87388b7e5557ea048f035f8790fc7b5d087b03ff Mon Sep 17 00:00:00 2001 From: Max Katz Date: Thu, 14 Nov 2024 19:47:37 -0800 Subject: [PATCH 3/5] Fix Avalonia.ReactiveUI --- readme.md | 8 ++++++++ templates/csharp/xplat/Directory.Packages.props | 4 ++++ 2 files changed, 12 insertions(+) diff --git a/readme.md b/readme.md index ec38d790..0faeb98a 100644 --- a/readme.md +++ b/readme.md @@ -169,6 +169,14 @@ Available parameters: *By default*: false +``-cpm`` + +*Description*: Defines if your app will Central Package Management (CPM). If disabled, Directory.Build.props will be created with shared Avalonia version. + +*Options*: **true**, **false** + +*By default*: true + # Creating a new Window To create a new `Window` called `MyNewWindow`, in the namespace `MyApp` run: diff --git a/templates/csharp/xplat/Directory.Packages.props b/templates/csharp/xplat/Directory.Packages.props index 7950431c..16210b41 100644 --- a/templates/csharp/xplat/Directory.Packages.props +++ b/templates/csharp/xplat/Directory.Packages.props @@ -15,8 +15,12 @@ + + + + From 51c6dbac8c4ebd79ced51154e9b457cfa81af390 Mon Sep 17 00:00:00 2001 From: Max Katz Date: Thu, 14 Nov 2024 19:59:24 -0800 Subject: [PATCH 4/5] Update SDK --- azure-pipelines.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 25603f1b..5a721e98 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -5,7 +5,7 @@ steps: displayName: 'Use .NET SDK' inputs: packageType: 'sdk' - version: 8.0.100 + version: 9.0.100 - task: DotNetCoreCLI@2 displayName: 'Pack Templates' inputs: From 6028455efb61e259f93afca650b6bbcdd961b99b Mon Sep 17 00:00:00 2001 From: Max Katz Date: Thu, 14 Nov 2024 19:59:34 -0800 Subject: [PATCH 5/5] Condition in sln file --- templates/csharp/xplat/AvaloniaTest.sln | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/templates/csharp/xplat/AvaloniaTest.sln b/templates/csharp/xplat/AvaloniaTest.sln index eb4a7c6f..40985abf 100644 --- a/templates/csharp/xplat/AvaloniaTest.sln +++ b/templates/csharp/xplat/AvaloniaTest.sln @@ -15,7 +15,11 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AvaloniaTest.Android", "Ava EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{3DA99C4E-89E3-4049-9C22-0A7EC60D83D8}" ProjectSection(SolutionItems) = preProject +#if (UseCentralPackageManagement) Directory.Build.props = Directory.Build.props +#else + Directory.Build.props = Directory.Build.props +#endif EndProjectSection EndProject Global