enkodellc / blazorboilerplate

Blazor Boilerplate / Starter Template with MudBlazor

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Build Error The type or namespace name 'DataInterfaces' does not exist in the namespace 'BlazorBoilerplate.Shared'

RajeshGunasundaram opened this issue · comments

The class library BlazorBoilerplate.Shared.DataInterfaces successfully compiled. Also having proper project reference in BlazorBoilerplate.Shared.Localizer. But, still I get this error on build.

Rebuild BlazorBoilerplate.Shared project.

I got this when I'd opened the project in VS 2019 by mistake. If that's the case @RajeshGunasundaram , try building it in VS 2022 instead.

commented

@RajeshGunasundaram, did you make changes to your EF models? That is when I usually get those errors.

  1. Make sure you update your EF
  2. dotnet tool install -g dotnet-ef or dotnet tool update -g dotnet-ef

Here is my process for updating models:

Step 1 -> Create your Model in the Project / Folder - BlazorBoilerplate.Infrastructure.Storage.DataModels - Keep namespace, do not append any because of source generator
Step 2 -> Powershell / Package Manager Console -> cd Server\BlazorBoilerplate.Storage
Step 3 -> Update BlazorBoilerplate.Storage ApplicationDbContext to have the DbSet for the new Tables if added
Step 4 -> Build Solution
Step 5 -> dotnet ef --startup-project ../BlazorBoilerplate.Server/ migrations add NAMEOFMIGRATION -c ApplicationDbContext --verbose --no-build --configuration Debug -o "Migrations/ApplicationDb"
Step 6 -> Review BlazorBoilerplate.Storage Migrations/ApplicationDb for the new migration
Step 7 -> Run the project. The database changes should now be applied.
Step 8 -> If it continues to error i normally restart VS. and clear the obj and bin folder in the project. This happens to me more often than I like.

commented

Hi,
Have had similar issues after installing the template then using VS2019/2020 with the project template in Windows 11 to create a new project, works fine in Windows 10 and server 2019.

Regards
Peter

Rebuild BlazorBoilerplate.Shared project.
I have this issue as wel.. There are tons of references broken. The information that is provided on the help page or here is not fixing the issue at all. I can't rebuilt the shared folder because VS doesnt want to rebuild when there are reference errors.

Also I didnt make any changes. I just did a fresh pull from here.

In any case is not a project issue, but Visual Studio issue. Do not use VS 2019.

If you have Windows 11, download all updates.

Also VS in some cases shows inexistent errors. So close VS run https://github.com/enkodellc/blazorboilerplate/blob/master/src/Utils/Scripts/delObjBin.ps1 open VS and rebuild

commented

I just got this issue again when updating my dbContext, using VS 2022 Community and Windows 10. I will document my steps to fix.

commented

I rebooted my system and it now builds fine. So I am going to say that this happens if you have some wrong in your dbContext / EF. Then Visual Studios cache gets corrupted and a reboot will fix it. If you have cleaned up your dbContext and then run your EF migration. At least that worked for me. So I am going to call this a fix and close.

commented

I also get this: Missing CLR Navigation Property' - for StructuralType just got it, which a Breeze error and when that happens even if I fix the navigation property within the code I have to reboot my machine.