Skip to content

Commit

Permalink
Merge pull request #241 from AvaloniaUI/update-templates-to-support-net8
Browse files Browse the repository at this point in the history
Update templates to support NET8
  • Loading branch information
Takoooooo authored Dec 6, 2023
2 parents 66f3823 + 5707c05 commit eb48d32
Show file tree
Hide file tree
Showing 12 changed files with 71 additions and 49 deletions.
2 changes: 1 addition & 1 deletion Avalonia.Templates.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<PackageType>Template</PackageType>
<PackageVersion>11.0.5</PackageVersion>
<PackageVersion>11.0.6</PackageVersion>
<PackageId>Avalonia.Templates</PackageId>
<Title>Avalonia Templates</Title>
<Description>Templates for creating Avalonia applications and libraries.</Description>
Expand Down
2 changes: 1 addition & 1 deletion azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ steps:
displayName: 'Use .NET SDK'
inputs:
packageType: 'sdk'
version: 7.0.302
version: 8.0.100
- task: DotNetCoreCLI@2
displayName: 'Pack Templates'
inputs:
Expand Down
18 changes: 9 additions & 9 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ For more information about `dotnet new` templates see [here](https://blogs.msdn.

## Installing the templates

Run from a command line (`.NET 7`):
Run from a command line (`.NET 7+`):

```powershell
dotnet new install Avalonia.Templates
Expand Down Expand Up @@ -50,17 +50,17 @@ Available parameters:

*Description*: The target framework for the project.

*Options*: **net6.0**, **net7.0**
*Options*: **net6.0**, **net7.0**, **net8.0**

*By default*: net6.0
*By default*: net8.0

``-av, --avalonia-version``

*Description*: The target version of Avalonia NuGet packages.

*Options*: **0.10.21**, **11.0.5**
*Options*: **0.10.21**, **11.0.6**

*By default*: 11.0.5
*By default*: 11.0.6

``-cb, --compiled-bindings``

Expand Down Expand Up @@ -91,17 +91,17 @@ Available parameters:

*Description*: The target framework for the project.

*Options*: **net6.0**, **net7.0**
*Options*: **net6.0**, **net7.0**, **net8.0**

*By default*: net6.0
*By default*: net8.0

``-av, --avalonia-version``

*Description*: The target version of Avalonia NuGet packages.

*Options*: **0.10.21**, **11.0.5**
*Options*: **0.10.21**, **11.0.6**

*By default*: 11.0.5
*By default*: 11.0.6

``-cb, --compiled-bindings``

Expand Down
16 changes: 10 additions & 6 deletions templates/csharp/app-mvvm/.template.config/template.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,14 @@
{
"choice": "net7.0",
"description": "Target net7.0"
},
{
"choice": "net8.0",
"description": "Target net8.0"
}
],
"replaces": "FrameworkParameter",
"defaultValue": "net6.0"
"defaultValue": "net8.0"
},
"skipRestore": {
"type": "parameter",
Expand Down Expand Up @@ -72,24 +76,24 @@
"description": "Target 0.10.21"
},
{
"choice": "11.0.5",
"description": "Target 11.0.5 (Latest stable)"
"choice": "11.0.6",
"description": "Target 11.0.6 (Latest stable)"
}
],
"replaces": "AvaloniaVersionTemplateParameter",
"defaultValue": "11.0.5"
"defaultValue": "11.0.6"
},
"AvaloniaStableChosen": {
"type": "computed",
"value": "(AvaloniaVersion == \"11.0.5\")"
"value": "(AvaloniaVersion == \"11.0.6\")"
},
"UseCompiledBindings": {
"type": "parameter",
"description": "Defines if CompiledBindings should be enabled by default in the project (only supported in 11.0 version and newer).",
"datatype": "bool",
"displayName": "Use compiled Bindings",
"defaultValue": "true",
"isEnabled": "(AvaloniaVersion == \"11.0.5\")"
"isEnabled": "(AvaloniaVersion == \"11.0.6\")"
},
"RemoveViewLocator": {
"type": "parameter",
Expand Down
16 changes: 10 additions & 6 deletions templates/csharp/app/.template.config/template.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,14 @@
{
"choice": "net7.0",
"description": "Target net7.0"
},
{
"choice": "net8.0",
"description": "Target net8.0"
}
],
"replaces": "FrameworkParameter",
"defaultValue": "net6.0"
"defaultValue": "net8.0"
},
"skipRestore": {
"type": "parameter",
Expand All @@ -48,24 +52,24 @@
"description": "Target 0.10.21"
},
{
"choice": "11.0.5",
"description": "Target 11.0.5 (Latest stable)"
"choice": "11.0.6",
"description": "Target 11.0.6 (Latest stable)"
}
],
"replaces": "AvaloniaVersionTemplateParameter",
"defaultValue": "11.0.5"
"defaultValue": "11.0.6"
},
"AvaloniaStableChosen": {
"type": "computed",
"value": "(AvaloniaVersion == \"11.0.5\")"
"value": "(AvaloniaVersion == \"11.0.6\")"
},
"UseCompiledBindings": {
"type": "parameter",
"description": "Defines if CompiledBindings should be enabled by default in the project (only supported in 11.0 version and newer).",
"datatype": "bool",
"displayName": "Use compiled Bindings",
"defaultValue": "true",
"isEnabled": "(AvaloniaVersion == \"11.0.5\")"
"isEnabled": "(AvaloniaVersion == \"11.0.6\")"
},
"HostIdentifier": {
"type": "bind",
Expand Down
6 changes: 3 additions & 3 deletions templates/csharp/xplat/.template.config/template.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@
"datatype": "choice",
"choices": [
{
"choice": "net7.0",
"description": "Target net7.0"
"choice": "net8.0",
"description": "Target net8.0"
}
],
"replaces": "FrameworkParameter",
"defaultValue": "net7.0"
"defaultValue": "net8.0"
},
"UseCompiledBindings": {
"type": "parameter",
Expand Down
2 changes: 1 addition & 1 deletion templates/csharp/xplat/Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project>
<PropertyGroup>
<Nullable>enable</Nullable>
<AvaloniaVersion>11.0.5</AvaloniaVersion>
<AvaloniaVersion>11.0.6</AvaloniaVersion>
</PropertyGroup>
</Project>
16 changes: 10 additions & 6 deletions templates/fsharp/app-mvvm/.template.config/template.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,14 @@
{
"choice": "net7.0",
"description": "Target net7.0"
},
{
"choice": "net8.0",
"description": "Target net8.0"
}
],
"replaces": "FrameworkParameter",
"defaultValue": "net6.0"
"defaultValue": "net8.0"
},
"skipRestore": {
"type": "parameter",
Expand Down Expand Up @@ -72,24 +76,24 @@
"description": "Target 0.10.21"
},
{
"choice": "11.0.5",
"description": "Target 11.0.5 (Latest stable)"
"choice": "11.0.6",
"description": "Target 11.0.6 (Latest stable)"
}
],
"replaces": "AvaloniaVersionTemplateParameter",
"defaultValue": "11.0.5"
"defaultValue": "11.0.6"
},
"AvaloniaStableChosen": {
"type": "computed",
"value": "(AvaloniaVersion == \"11.0.5\")"
"value": "(AvaloniaVersion == \"11.0.6\")"
},
"UseCompiledBindings": {
"type": "parameter",
"description": "Defines if CompiledBindings should be enabled by default in the project (only supported in 11.0 version and newer).",
"datatype": "bool",
"displayName": "Use compiled Bindings",
"defaultValue": "true",
"isEnabled": "(AvaloniaVersion == \"11.0.5\")"
"isEnabled": "(AvaloniaVersion == \"11.0.6\")"
},
"RemoveViewLocator": {
"type": "parameter",
Expand Down
16 changes: 10 additions & 6 deletions templates/fsharp/app/.template.config/template.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,14 @@
{
"choice": "net7.0",
"description": "Target net7.0"
},
{
"choice": "net8.0",
"description": "Target net8.0"
}
],
"replaces": "FrameworkParameter",
"defaultValue": "net6.0"
"defaultValue": "net8.0"
},
"skipRestore": {
"type": "parameter",
Expand All @@ -48,24 +52,24 @@
"description": "Target 0.10.21"
},
{
"choice": "11.0.5",
"description": "Target 11.0.5 (Latest stable)"
"choice": "11.0.6",
"description": "Target 11.0.6 (Latest stable)"
}
],
"replaces": "AvaloniaVersionTemplateParameter",
"defaultValue": "11.0.5"
"defaultValue": "11.0.6"
},
"AvaloniaStableChosen": {
"type": "computed",
"value": "(AvaloniaVersion == \"11.0.5\")"
"value": "(AvaloniaVersion == \"11.0.6\")"
},
"UseCompiledBindings": {
"type": "parameter",
"description": "Defines if CompiledBindings should be enabled by default in the project (only supported in 11.0 version and newer).",
"datatype": "bool",
"displayName": "Use compiled Bindings",
"defaultValue": "true",
"isEnabled": "(AvaloniaVersion == \"11.0.5\")"
"isEnabled": "(AvaloniaVersion == \"11.0.6\")"
},
"HostIdentifier": {
"type": "bind",
Expand Down
6 changes: 3 additions & 3 deletions templates/fsharp/xplat/.template.config/template.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@
"datatype": "choice",
"choices": [
{
"choice": "net7.0",
"description": "Target net7.0"
"choice": "net8.0",
"description": "Target net8.0"
}
],
"replaces": "FrameworkParameter",
"defaultValue": "net7.0"
"defaultValue": "net8.0"
},
"UseCompiledBindings": {
"type": "parameter",
Expand Down
2 changes: 1 addition & 1 deletion templates/fsharp/xplat/Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<Project>
<PropertyGroup>
<AvaloniaVersion>11.0.5</AvaloniaVersion>
<AvaloniaVersion>11.0.6</AvaloniaVersion>
</PropertyGroup>
</Project>
18 changes: 12 additions & 6 deletions tests/build-test.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -96,48 +96,54 @@ $binlog = [IO.Path]::GetFullPath([IO.Path]::Combine($pwd, "..", "binlog", "test.

Create-And-Build "avalonia.app" "AvaloniaApp" "C#" "f" "net6.0" $binlog
Create-And-Build "avalonia.app" "AvaloniaApp" "C#" "f" "net7.0" $binlog
Create-And-Build "avalonia.app" "AvaloniaApp" "C#" "f" "net8.0" $binlog
Create-And-Build "avalonia.app" "AvaloniaApp" "C#" "av" "0.10.21" $binlog
Create-And-Build "avalonia.app" "AvaloniaApp" "C#" "av" "11.0.5" $binlog
Create-And-Build "avalonia.app" "AvaloniaApp" "C#" "av" "11.0.6" $binlog
Create-And-Build "avalonia.app" "AvaloniaApp" "C#" "cb" "true" $binlog
Create-And-Build "avalonia.app" "AvaloniaApp" "C#" "cb" "false" $binlog

# Build the project only twice with all item templates,once with .net6.0 tfm and once with .net7.0 tfm for C# and F#
Test-Template "avalonia.mvvm" "AvaloniaMvvm" "C#" "f" "net6.0" $binlog
Test-Template "avalonia.mvvm" "AvaloniaMvvm" "C#" "f" "net7.0" $binlog
Test-Template "avalonia.mvvm" "AvaloniaMvvm" "C#" "f" "net8.0" $binlog
Create-And-Build "avalonia.mvvm" "AvaloniaMvvm" "C#" "av" "0.10.21" $binlog
Create-And-Build "avalonia.mvvm" "AvaloniaMvvm" "C#" "av" "11.0.5" $binlog
Create-And-Build "avalonia.mvvm" "AvaloniaMvvm" "C#" "av" "11.0.6" $binlog
Create-And-Build "avalonia.mvvm" "AvaloniaMvvm" "C#" "m" "ReactiveUI" $binlog
Create-And-Build "avalonia.mvvm" "AvaloniaMvvm" "C#" "m" "CommunityToolkit" $binlog
Create-And-Build "avalonia.mvvm" "AvaloniaMvvm" "C#" "cb" "true" $binlog
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" "net7.0" $binlog
Create-And-Build "avalonia.xplat" "AvaloniaXplat" "C#" "f" "net8.0" $binlog
Create-And-Build "avalonia.xplat" "AvaloniaXplat" "C#" "cb" "true" $binlog
Create-And-Build "avalonia.xplat" "AvaloniaXplat" "C#" "cb" "false" $binlog
Create-And-Build "avalonia.xplat" "AvaloniaXplat" "C#" "rvl" "true" $binlog
Create-And-Build "avalonia.xplat" "AvaloniaXplat" "C#" "rvl" "false" $binlog

Create-And-Build "avalonia.app" "AvaloniaApp" "F#" "f" "net6.0" $binlog
Create-And-Build "avalonia.app" "AvaloniaApp" "F#" "f" "net7.0" $binlog
Create-And-Build "avalonia.app" "AvaloniaApp" "F#" "f" "net8.0" $binlog
Create-And-Build "avalonia.app" "AvaloniaApp" "F#" "av" "0.10.21" $binlog
Create-And-Build "avalonia.app" "AvaloniaApp" "F#" "av" "11.0.5" $binlog
Create-And-Build "avalonia.app" "AvaloniaApp" "F#" "av" "11.0.6" $binlog
Create-And-Build "avalonia.app" "AvaloniaApp" "F#" "cb" "true" $binlog
Create-And-Build "avalonia.app" "AvaloniaApp" "F#" "cb" "false" $binlog

Remove-Item -Recurse "output/C#"

Test-Template "avalonia.mvvm" "AvaloniaMvvm" "F#" "f" "net6.0" $binlog
Test-Template "avalonia.mvvm" "AvaloniaMvvm" "F#" "f" "net7.0" $binlog
Test-Template "avalonia.mvvm" "AvaloniaMvvm" "F#" "f" "net8.0" $binlog
Create-And-Build "avalonia.mvvm" "AvaloniaMvvm" "F#" "av" "0.10.21" $binlog
Create-And-Build "avalonia.mvvm" "AvaloniaMvvm" "F#" "av" "11.0.5" $binlog
Create-And-Build "avalonia.mvvm" "AvaloniaMvvm" "F#" "av" "11.0.6" $binlog
Create-And-Build "avalonia.mvvm" "AvaloniaMvvm" "F#" "m" "ReactiveUI" $binlog
Create-And-Build "avalonia.mvvm" "AvaloniaMvvm" "F#" "m" "CommunityToolkit" $binlog
Create-And-Build "avalonia.mvvm" "AvaloniaMvvm" "F#" "cb" "true" $binlog
Create-And-Build "avalonia.mvvm" "AvaloniaMvvm" "F#" "cb" "false" $binlog
Create-And-Build "avalonia.mvvm" "AvaloniaMvvm" "F#" "rvl" "true" $binlog
Create-And-Build "avalonia.mvvm" "AvaloniaMvvm" "F#" "rvl" "false" $binlog

Create-And-Build "avalonia.xplat" "AvaloniaXplat" "F#" "f" "net7.0" $binlog
Create-And-Build "avalonia.xplat" "AvaloniaXplat" "F#" "f" "net8.0" $binlog
Create-And-Build "avalonia.xplat" "AvaloniaXplat" "F#" "cb" "true" $binlog
Create-And-Build "avalonia.xplat" "AvaloniaXplat" "F#" "cb" "false" $binlog
Create-And-Build "avalonia.xplat" "AvaloniaXplat" "F#" "rvl" "true" $binlog
Expand Down

0 comments on commit eb48d32

Please sign in to comment.