ā 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:
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"
54 Replies
you don't need the dotnet restore
try
and get rid of --no-restore
dotnet build already runs restore
I think it's split into two to make the errors more separated depending on which process fails
it's the template straight from Github, I just changed 6.0.x to 7.0.x
do you think the restore being separate is the issue?
maybe
can you try my suggestions
?
trying the change of version number right now
made all the changes you suggested, same error occurrs
at what step does the error occur?
the build
after it restores the projects in the solution, it lists the two warnings, and then the error
is this an upgrade from an old .net version?
Shouldn't be but I may have upgraded directly after making the project
can you try running on windows
runs-on: windows-latest
i think you are missing a packagereference
or does it build fine on your IDE?
It builds just fine, but it could be the IDE is doing something for me that I just don't know about?
builds fine locally, I mean
it should work in github then
try windows
let me know
building rn. Much slower than ubuntu š¦
yeah
Same error
damn
so I don't have a PackageReference for Microsoft.AspNetCore.Authentication in my project file, could that be part of the issue?
It's not a NuGet package, it's from the SDK
you shouldn't need to
can you share your cs proj?
Those Reference Includes with the long relative path look kinda suspicious
get rid of those, and run dotnet build
see if it builds fine
that's the issue, github can't find those references
Now it throws the same error as Github
Okay, so how do I do this the right way?
get those packages via nuget
or are they private?
they all seem nuget
I think they're copied straight from the .net7 sdk
I can't find them on NuGet
not the version I have locally
only deprecated versions
they are part of the sdk
if you need them
like that
github needs them
I th ought that is what the dotnet-setup action was taking care of. Installing the SDK or whatever
but if you get rid of them
where in the code does it throw errors
add a using
At a
using Microsoft.AspNetCore.Authentication.Cookies;
callremove it
where does it break
The CookieAuthenticationDefaults in this line:
ClaimsIdentity claimIdent = new(claims, CookieAuthenticationDefaults.AuthenticationScheme);
I am realizing my IDE's build button doesn't generate the error but dotnet build
does
šmaybe the ide is fixing it automatically
is this a class library?
Yeah
try that
dotnet build
nice!
That worked
excellent
now try github, you can go back to ubuntu
The IDE's auto-import did that relative path crap instead of this, dunno why
yeah so the problem is that they are part of the SDK
but they are part of Sdk.Web
and that's not included
in the core sdk
I just dunno why it decided to do that janky relative path instead of this FrameworkReference option
someone did that
probably
Made the project non-portable
absolutely
It was definitely the IDE doing it, I can recreate it by using the quick action to import that library
oh well
yeah the IDE fixes a lot of things
this is excellent, learned a lot too
ty for your help
no worries
gonna double-check github now
let me know
go back to ubuntu
xd
Nice! Now it's a build error I expected instead of the issue with references. Thanks again.
amazing!
well that you can fix i hope
haha
yeah, I know what to do B-)
Unknown Userā¢2y ago
Message Not Public
Sign In & Join Server To View
It's a class library. I think we got the issue sorted though
IDE was referencing asp.net libraries with a weird relative path instead of a framework reference
Unknown Userā¢2y ago
Message Not Public
Sign In & Join Server To View