apexcharts / Blazor-ApexCharts

A blazor wrapper for ApexCharts.js
https://apexcharts.github.io/Blazor-ApexCharts
MIT License
784 stars 91 forks source link

Update csproj file to enable multi targeting #407

Closed thirstyape closed 6 months ago

thirstyape commented 6 months ago

Hey @joadan,

Pretty simple change request here, will just bundle compiled versions for each of .NET 6.0, .NET 7.0, and .NET 8.0 into the NuGet package and use whichever applies to the project that uses the package.

I have also updated the versions for Microsoft.AspNetCore.Components to be framework specific and have a minimum version as per this security advisory.

I have not tested on 7, but both 6 and 8 seem to work fine.

joadan commented 6 months ago

Hi,

I was not able to get the build action to work. Do you have any idea how to set it up?

https://github.com/apexcharts/Blazor-ApexCharts/blob/master/.github/workflows/dotnetcore.yml

thirstyape commented 6 months ago

The syntax here is a little unfamiliar as I primarily use Jenkins but overall fairly similar.

Looking at your updated .yml file I think that the matrix: specifier is what is needed. This post from SO seems to have a couple of good suggestions. I think in this case the ${{ matrix.dotnet }} will need to be used for each of dotnet-version, restore, and build as each framework targets different versions of the required NuGet package.

I would try the following, if it fails I will have time to test things later this week.

name: .NET Core

on:
  push:
    branches: [ master ]
  pull_request:
    branches: [ master ]

jobs:
  build:

    runs-on: ubuntu-latest
    strategy:
      matrix:
        dotnet: [8, 7, 6]

    steps:
    - uses: actions/checkout@v2
    - name: Setup .NET Core
      uses: actions/setup-dotnet@v1
      with:
        dotnet-version: ${{ matrix.dotnet }}.0.x
    - name: Install dependencies
      run: dotnet restore -p:TargetFramework=net${{ matrix.dotnet }}
    - name: Build
      run: dotnet build --configuration Release --no-restore --framework net${{ matrix.dotnet }}.0
      working-directory: ./src/Blazor-ApexCharts