✅ Razor pages template gives me an immediate build error

Why is it telling me "The type or namespace name 'EntityFrameworkCore' does not exist in the namespace 'Microsoft.AspNetCore.Identity'" right after I generated a Razor pages project template with single user authentication enabled? How do I fix this?
22 Replies
sibber
sibber3w ago
thats weird try adding the package manually
King TMK 🎗
King TMK 🎗OP3w ago
I've tried to remove and add them again, but I'm getting the same thing
sibber
sibber3w ago
you have the package added? can i see the csproj?
King TMK 🎗
King TMK 🎗OP3w ago
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<UserSecretsId>aspnet-WebApplication1-a42b01ed-c7dc-4819-ab9a-22e019eed651</UserSecretsId>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore" Version="8.0.8" />
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="8.0.8" />
<PackageReference Include="Microsoft.AspNetCore.Identity.UI" Version="8.0.8" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="8.0.8" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="8.0.8" />
</ItemGroup>

</Project>
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<UserSecretsId>aspnet-WebApplication1-a42b01ed-c7dc-4819-ab9a-22e019eed651</UserSecretsId>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore" Version="8.0.8" />
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="8.0.8" />
<PackageReference Include="Microsoft.AspNetCore.Identity.UI" Version="8.0.8" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="8.0.8" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="8.0.8" />
</ItemGroup>

</Project>
sibber
sibber3w ago
to be clear, youre just creating the project and changing nothing right?
King TMK 🎗
King TMK 🎗OP3w ago
That's right
sibber
sibber3w ago
visual studio?
King TMK 🎗
King TMK 🎗OP3w ago
I created it and immediately tried to build it but it gave me build errors Yes
sibber
sibber3w ago
can you clean and try to build from the cli? make sure obj and bin are deleted
King TMK 🎗
King TMK 🎗OP3w ago
Where's obj and bin, I'm completely new to dotnet
sibber
sibber3w ago
in the output folder oops sorry its in the same folder as the csproj it is the build output folder forgot for a sec anyway just delete those, then dotnet clean and dotnet build
King TMK 🎗
King TMK 🎗OP3w ago
Thanks, I did now, but after building it's telling me
C:\Users\tomkr\source\repos\WebApplication1\WebApplication1\WebApplication1.csproj : error NU1101: Unable to find package Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore. No packages exist with this id in source(s): C:\Program Files\dotnet\library-packs, Microsoft Visual Studio Offline Packages
C:\Users\tomkr\source\repos\WebApplication1\WebApplication1\WebApplication1.csproj : error NU1101: Unable to find package Microsoft.AspNetCore.Identity.EntityFrameworkCore. No packages exist with this id in source(s): C:\Program Files\dotnet\library-packs, Microsoft Visual Studio Offline Packages
C:\Users\tomkr\source\repos\WebApplication1\WebApplication1\WebApplication1.csproj : error NU1101: Unable to find package Microsoft.AspNetCore.Identity.UI. No packages exist with this id in source(s): C:\Program Files\dotnet\library-packs, Microsoft Visual Studio Offline Packages
C:\Users\tomkr\source\repos\WebApplication1\WebApplication1\WebApplication1.csproj : error NU1101: Unable to find package Microsoft.EntityFrameworkCore.SqlServer. No packages exist with this id in source(s): C:\Program Files\dotnet\library-packs, Microsoft Visual Studio Offline Packages
C:\Users\tomkr\source\repos\WebApplication1\WebApplication1\WebApplication1.csproj : error NU1101: Unable to find package Microsoft.EntityFrameworkCore.Tools. No packages exist with this id in source(s): C:\Program Files\dotnet\library-packs, Microsoft Visual Studio Offline Packages
C:\Users\tomkr\source\repos\WebApplication1\WebApplication1\WebApplication1.csproj : error NU1101: Unable to find package Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore. No packages exist with this id in source(s): C:\Program Files\dotnet\library-packs, Microsoft Visual Studio Offline Packages
C:\Users\tomkr\source\repos\WebApplication1\WebApplication1\WebApplication1.csproj : error NU1101: Unable to find package Microsoft.AspNetCore.Identity.EntityFrameworkCore. No packages exist with this id in source(s): C:\Program Files\dotnet\library-packs, Microsoft Visual Studio Offline Packages
C:\Users\tomkr\source\repos\WebApplication1\WebApplication1\WebApplication1.csproj : error NU1101: Unable to find package Microsoft.AspNetCore.Identity.UI. No packages exist with this id in source(s): C:\Program Files\dotnet\library-packs, Microsoft Visual Studio Offline Packages
C:\Users\tomkr\source\repos\WebApplication1\WebApplication1\WebApplication1.csproj : error NU1101: Unable to find package Microsoft.EntityFrameworkCore.SqlServer. No packages exist with this id in source(s): C:\Program Files\dotnet\library-packs, Microsoft Visual Studio Offline Packages
C:\Users\tomkr\source\repos\WebApplication1\WebApplication1\WebApplication1.csproj : error NU1101: Unable to find package Microsoft.EntityFrameworkCore.Tools. No packages exist with this id in source(s): C:\Program Files\dotnet\library-packs, Microsoft Visual Studio Offline Packages
sibber
sibber3w ago
ah you need to add nuget.org as a source
King TMK 🎗
King TMK 🎗OP3w ago
How do I do that, and how come?
sibber
sibber3w ago
what does dotnet nuget list source output?
King TMK 🎗
King TMK 🎗OP3w ago
Registered Sources:
1. Microsoft Visual Studio Offline Packages [Enabled]
C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\
Registered Sources:
1. Microsoft Visual Studio Offline Packages [Enabled]
C:\Program Files (x86)\Microsoft SDKs\NuGetPackages\
sibber
sibber3w ago
yeah for some reason nuget.org isnt there how did you download .net btw? dotnet nuget add source https://api.nuget.org/v3/index.json --name nuget.org to add it
King TMK 🎗
King TMK 🎗OP3w ago
I believe it was through the installer from the browser, I don't remember now, it was quite some time ago It looks like it's building correctly now
sibber
sibber3w ago
every once in a while someone would come here with the same issue where nuget.org not added as a source and im yet to figure out how that happens it should be the default
King TMK 🎗
King TMK 🎗OP3w ago
Don't give up Thank you though, it built now
sibber
sibber3w ago
$close
MODiX
MODiX3w ago
If you have no further questions, please use /close to mark the forum thread as answered
Want results from more Discord servers?
Add your server