the namespace is not recognised
hey so I am making a wpf app that will be a flight booking app but I will be storing user data on an azure sql database I am trying to create a REST API and so far I have made a ASP.NetService named FakeFlightBookingAPI I made this class named ApplicationDbContext to interact with my database here and I am trying ref my Admin and Customer classes that are part of my WPF project not my ASP project and my code is below
my errrors are
Severity Code Description Project File Line Suppression State Details
Error CS0246 The type or namespace name 'FakeFlightBookingApp' could not be found (are you missing a using directive or an assembly reference?) FakeFlightBookingAPI D:\Zeeshan\Documents\FakeFlightBookingAPI\Data\ApplicationDbContext.cs 2 Active
Severity Code Description Project File Line Suppression State Details Error CS0246 The type or namespace name 'Customer' could not be found (are you missing a using directive or an assembly reference?) FakeFlightBookingAPI D:\Zeeshan\Documents\FakeFlightBookingAPI\Data\ApplicationDbContext.cs 11 Active
Severity Code Description Project File Line Suppression State Details Error CS0246 The type or namespace name 'Admin' could not be found (are you missing a using directive or an assembly reference?) FakeFlightBookingAPI D:\Zeeshan\Documents\FakeFlightBookingAPI\Data\ApplicationDbContext.cs 10 Active
Severity Code Description Project File Line Suppression State Details Error CS0246 The type or namespace name 'Customer' could not be found (are you missing a using directive or an assembly reference?) FakeFlightBookingAPI D:\Zeeshan\Documents\FakeFlightBookingAPI\Data\ApplicationDbContext.cs 11 Active
Severity Code Description Project File Line Suppression State Details Error CS0246 The type or namespace name 'Admin' could not be found (are you missing a using directive or an assembly reference?) FakeFlightBookingAPI D:\Zeeshan\Documents\FakeFlightBookingAPI\Data\ApplicationDbContext.cs 10 Active
10 Replies
so yeah I cant seem to ref my customer and admin class long story short lol any idea whhy?
I did an add ref too
You have a warning in your dependencies
Severity Code Description Project File Line Suppression State Details
Warning NETSDK1137 It is no longer necessary to use the Microsoft.NET.Sdk.WindowsDesktop SDK. Consider changing the Sdk attribute of the root Project element to 'Microsoft.NET.Sdk'. FakeFlightBookingApp C:\Program Files\dotnet\sdk\8.0.200\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.DefaultItems.targets 148
and it took me here
Why is the API referencing things from the app?
I think you have that backwards. Move the models you need to use in your API project to the API project. Then make the App reference the API project.
Although... Honestly, I'm not sure why you are having an issue doing what you did.
oh so my customer and admin class should be in my api project?
Yup
You should have your REST API standalone not depending on anything. Your application should be built on top of that.
ok thx
So if both projects need access to something, you put it in the REST API project.
Good Luck!