Skip to content

Commit

Permalink
Update to .NET 9
Browse files Browse the repository at this point in the history
  • Loading branch information
jfversluis committed Dec 29, 2024
1 parent e50be28 commit 6694dd7
Show file tree
Hide file tree
Showing 5 changed files with 52 additions and 12 deletions.
16 changes: 14 additions & 2 deletions .github/workflows/ci-sample.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,24 @@ on:
pull_request:
branches: [ "main" ]

env:
DOTNET_VERSION: '9.0.x' # The .NET SDK version to use

jobs:
build-sample-ci:

runs-on: windows-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: ${{ env.DOTNET_VERSION }}

- name: Install .NET MAUI Workload
run: dotnet workload restore samples\Plugin.Maui.Pedometer.Sample.sln

- name: Build
run: dotnet build samples\Plugin.Maui.Pedometer.Sample.sln -c Release
run: dotnet build samples\Plugin.Maui.Pedometer.Sample.sln -c Release
16 changes: 14 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,24 @@ on:
pull_request:
branches: [ "main" ]

env:
DOTNET_VERSION: '9.0.x' # The .NET SDK version to use

jobs:
build-plugin-ci:

runs-on: windows-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: ${{ env.DOTNET_VERSION }}

- name: Install .NET MAUI Workload
run: dotnet workload restore samples\Plugin.Maui.Pedometer.Sample.sln

- name: Build
run: dotnet build src\Plugin.Maui.Pedometer.sln -c Release
run: dotnet build src\Plugin.Maui.Pedometer.sln -c Release
21 changes: 18 additions & 3 deletions .github/workflows/release-nuget.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,38 @@ on:
tags:
- "v[0-9]+.[0-9]+.[0-9]+"
- "v[0-9]+.[0-9]+.[0-9]+-preview[0-9]+"

env:
DOTNET_VERSION: '9.0.x' # The .NET SDK version to use

jobs:
release-nuget:

runs-on: windows-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: ${{ env.DOTNET_VERSION }}

- name: Install .NET MAUI Workload
run: dotnet workload restore samples\Plugin.Maui.Pedometer.Sample.sln

- name: Verify commit exists in origin/main
run: |
git fetch --no-tags --prune --depth=1 origin +refs/heads/*:refs/remotes/origin/*
git branch --remote --contains | grep origin/main
- name: Get version information from tag
id: get_version
uses: battila7/get-version-action@v2
run: |
$version="${{github.ref_name}}".TrimStart("v")
"version-without-v=$version" | Out-File -FilePath $env:GITHUB_OUTPUT -Append
- name: Pack
run: dotnet pack src\Plugin.Maui.Pedometer.sln -c Release -p:PackageVersion=${{ steps.get_version.outputs.version-without-v }}
- name: Push
run: dotnet nuget push src\Plugin.Maui.Pedometer\bin\Release\Plugin.Maui.Pedometer.${{ steps.get_version.outputs.version-without-v }}.nupkg -s https://api.nuget.org/v3/index.json -k ${{ secrets.NUGET_API_KEY }}
env:
GITHUB_TOKEN: ${{ secrets.NUGET_API_KEY }}
GITHUB_TOKEN: ${{ secrets.NUGET_API_KEY }}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net7.0-android;net7.0-ios</TargetFrameworks>
<TargetFrameworks>net9.0-android;net9.0-ios</TargetFrameworks>
<OutputType>Exe</OutputType>
<RootNamespace>Plugin.Maui.Pedometer.Sample</RootNamespace>
<UseMaui>true</UseMaui>
Expand All @@ -13,7 +13,6 @@

<!-- App Identifier -->
<ApplicationId>com.companyname.pluginsample</ApplicationId>
<ApplicationIdGuid>A20E30BB-3BF7-4ACB-89F2-596834136909</ApplicationIdGuid>

<!-- Versions -->
<ApplicationDisplayVersion>1.0</ApplicationDisplayVersion>
Expand Down Expand Up @@ -42,6 +41,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Maui.Controls" Version="$(MauiVersion)" />
<ProjectReference Include="..\..\src\Plugin.Maui.Pedometer\Plugin.Maui.Pedometer.csproj" />
</ItemGroup>
</Project>
7 changes: 4 additions & 3 deletions src/Plugin.Maui.Pedometer/Plugin.Maui.Pedometer.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net7.0-android;net7.0-ios;net7.0</TargetFrameworks>
<TargetFrameworks>net9.0-android;net9.0-ios;net9.0</TargetFrameworks>
<SingleProject>true</SingleProject>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
Expand Down Expand Up @@ -59,14 +59,15 @@
</ItemGroup>
<!-- .NET (generic) -->
<ItemGroup Condition="!($(TargetFramework.StartsWith('net')) == true AND $(TargetFramework.EndsWith('.0')) == true AND $(TargetFramework.Contains('-')) != true)">
<!-- e.g net6.0 or net7.0 (and higher) -->
<!-- e.g net6.0 or net9.0 (and higher) -->
<Compile Remove="**\*.net.cs" />
<None Include="**\*.net.cs" Exclude="$(DefaultItemExcludes);$(DefaultExcludesInProjectFolder)" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Maui.Controls" Version="$(MauiVersion)" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0" PrivateAssets="all" IsImplicitlyDefined="true" />
<PackageReference Include="System.Management" Version="7.0.0" Condition="$(TargetFramework.Contains('-windows')) == true" />
<PackageReference Include="System.Management" Version="9.0.0" Condition="$(TargetFramework.Contains('-windows')) == true" />
</ItemGroup>

<!-- Package additions -->
Expand Down

0 comments on commit 6694dd7

Please sign in to comment.