C#C
C#3y ago
107 replies
P R Deltoid

✅ Compiling ASP.NET 7 app using Github Actions

I am trying to compile my ASP.NET 7 application solution using Github actions but am getting the following error:
error CS0234: The type or namespace name 'Authentication' does not exist in the namespace 'Microsoft.AspNetCore' (are you missing an assembly reference?) when building a project that requires this package. My github action looks like this:

name: .NET

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

jobs:
  build:

    runs-on: ubuntu-latest

    steps:
    - uses: actions/checkout@v3
    - name: Setup .NET
      uses: actions/setup-dotnet@v3
      with:
        dotnet-version: 7.0.x
    - name: Restore dependencies
      run: dotnet restore
    - name: Build
      run: dotnet build --no-restore
    - name: Test
      run: dotnet test --no-build --verbosity normal


I figured the GitHub Action's dotnet setup would have included these files. I know this isn't exactly a C# question but I figured people here might have experience with this particular problem. I'm a little confused on how my local build could find these files but the Github Action build cannot

Probably related, but I am also receiving warnings:
Could not locate the assembly "Microsoft.AspNetCore.Http.Features"
Could not locate the assembly "Microsoft.AspNetCore.Authentication.Cookies"
Was this page helpful?