Quantcast
Channel: Active questions tagged nuget-package - Stack Overflow
Viewing all articles
Browse latest Browse all 3067

Github Actions: Push nuget xamarin.forms package

$
0
0

I'm trying to configure a GitHub action that builds my multi-target Xamarin.Forms plugin and pushes the package to GitHub and NuGet. Pushing the package to GitHub and NuGet shouldn't be much of a problem anymore. I'm having trouble with building my multi-targeted nuget package on the GitHub CI.

First I had the following GitHub action:

name: .NET Coreon:  push:    branches: [ master ]  pull_request:    branches: [ master ]jobs:  build:    runs-on: ubuntu-latest    steps:    - name: Checkout      uses: actions/checkout@v2    - name: Setup .NET Core      uses: actions/setup-dotnet@v1.5.0      with:        dotnet-version: 3.1.301        # Authenticates packages to push to GPR        source-url: https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json      env:        NUGET_AUTH_TOKEN: '%NUGET_AUTH_TOKEN%'    - name: Install dependencies      run: dotnet restore    - name: Build      run: dotnet build --configuration Release --no-restore    - name: Test      run: dotnet test --no-restore --verbosity normal    - name: Pack      run: dotnet pack --no-build --configuration Release MintPlayer.MVVM/MintPlayer.MVVM.csproj --output .    - name: PushNuget      run: dotnet nuget push *.nupkg --source https://api.nuget.org/v3/index.json --api-key ${{ secrets.PUBLISH_TO_NUGET_ORG }} --skip-duplicate    - name: PushGithub      #run: dotnet nuget push *.nupkg --source https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json --api-key ${{ github.token }} --no-symbols --skip-duplicate      run: dotnet nuget push *.nupkg --no-symbols --skip-duplicate      env:        NUGET_AUTH_TOKEN: ${{ github.token }}

and also the following nuget.config in my solution root, to let the action know about the nuget source to download the required NuGet packages:

<?xml version="1.0" encoding="utf-8"?><configuration><packageSources><add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" /></packageSources></configuration>

When pushing this configuration to my GitHub repository, I'm getting the following errors at the Build stage:

/Users/runner/work/MintPlayer.MVVM/MintPlayer.MVVM/Demo/MintPlayer.MVVM.Demo/MintPlayer.MVVM.Demo.UWP/MintPlayer.MVVM.Demo.UWP.csproj(175,3): error MSB4019: The imported project "/Users/runner/hostedtoolcache/dncs/3.1.301/x64/sdk/3.1.301/Microsoft/WindowsXaml/v16.0/Microsoft.Windows.UI.Xaml.CSharp.targets" was not found. Confirm that the expression in the Import declaration "/Users/runner/hostedtoolcache/dncs/3.1.301/x64/sdk/3.1.301//Microsoft/WindowsXaml/v16.0/Microsoft.Windows.UI.Xaml.CSharp.targets" is correct, and that the file exists on disk./Users/runner/work/MintPlayer.MVVM/MintPlayer.MVVM/Demo/MintPlayer.MVVM.Demo/MintPlayer.MVVM.Demo.iOS/MintPlayer.MVVM.Demo.iOS.csproj(140,3): error MSB4019: The imported project "/Users/runner/hostedtoolcache/dncs/3.1.301/x64/sdk/3.1.301/Xamarin/iOS/Xamarin.iOS.CSharp.targets" was not found. Confirm that the expression in the Import declaration "/Users/runner/hostedtoolcache/dncs/3.1.301/x64/sdk/3.1.301//Xamarin/iOS/Xamarin.iOS.CSharp.targets" is correct, and that the file exists on disk./Users/runner/work/MintPlayer.MVVM/MintPlayer.MVVM/Demo/MintPlayer.MVVM.Demo/MintPlayer.MVVM.Demo.Android/MintPlayer.MVVM.Demo.Android.csproj(101,3): error MSB4019: The imported project "/Users/runner/hostedtoolcache/dncs/3.1.301/x64/sdk/3.1.301/Xamarin/Android/Xamarin.Android.CSharp.targets" was not found. Confirm that the expression in the Import declaration "/Users/runner/hostedtoolcache/dncs/3.1.301/x64/sdk/3.1.301//Xamarin/Android/Xamarin.Android.CSharp.targets" is correct, and that the file exists on disk.

I then modified my workflow to use msbuild instead (at least until the build stage:

name: .NET Coreon:  push:    branches: [ master ]  pull_request:    branches: [ master ]jobs:  build:    runs-on: macos-latest    steps:    - name: Checkout      uses: actions/checkout@v2    - name: Setup .NET Core      uses: actions/setup-dotnet@v1.5.0      with:        dotnet-version: 3.1.301        # Authenticates packages to push to GPR        source-url: https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json      env:        NUGET_AUTH_TOKEN: '%NUGET_AUTH_TOKEN%'    - name: Install dependencies      #run: dotnet restore      #env:      #  NUGET_AUTH_TOKEN: ${{ github.token }}      run: msbuild /t:restore    - name: Build      #run: dotnet build --configuration Release --no-restore      run: msbuild Library/MintPlayer.MVVM/MintPlayer.MVVM.csproj /p:Configuration=Release /p:RestorePackages=false    - name: Test      run: dotnet test --no-restore --verbosity normal    - name: Pack      run: dotnet pack --no-build --configuration Release MintPlayer.MVVM/MintPlayer.MVVM.csproj --output .    - name: PushNuget      run: dotnet nuget push *.nupkg --source https://api.nuget.org/v3/index.json --api-key ${{ secrets.PUBLISH_TO_NUGET_ORG }} --skip-duplicate    - name: PushGithub      #run: dotnet nuget push *.nupkg --source https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json --api-key ${{ github.token }} --no-symbols --skip-duplicate      run: dotnet nuget push *.nupkg --no-symbols --skip-duplicate      env:        NUGET_AUTH_TOKEN: ${{ github.token }}

But it's still not working.

The console in Github actions prints the following error between the tons of text:

/Users/runner/.nuget/packages/msbuild.sdk.extras/2.1.2/Build/LanguageTargets/CheckMissing.targets(44,5): error : The specified language targets for uap10.0.16299 is missing. Ensure correct tooling is installed for 'uap'. Missing: '/Library/Frameworks/Mono.framework/Versions/6.12.0/lib/mono/xbuild/Microsoft/WindowsXaml/v16.0/Microsoft.Windows.UI.Xaml.CSharp.targets' [/Users/runner/work/MintPlayer.MVVM/MintPlayer.MVVM/Library/MintPlayer.MVVM/MintPlayer.MVVM.csproj]

So this probably means that the UWP tools aren't available on macos. From the output I can see that the android build succeeds, the iOS build succeeds, but the UWP build fails with the former message.

How can I build a Xamarin.Forms package in GitHub CI and push it to my nuget sources?


Viewing all articles
Browse latest Browse all 3067

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>