[英]The type or namespace name does not exist in the namespace (are you missing an assembly reference?) - Can't reference a class
So, I'm doing some Angular + .NET Core course on Udemy and I stumbled upon a certain problem: I can't reference a class from ClientApp subfolder.所以,我在 Udemy 上做了一些 Angular + .NET 核心课程,我偶然发现了一个问题:我无法从 ClientApp 子文件夹中引用 class。 I created an Angular + .NET Core project in Visual Studio 2019. My backend app is in route folder and the frontend app is in subfolder ClientApp of my backend app.我在 Visual Studio 2019 中创建了一个 Angular + .NET Core 项目。我的后端应用程序在路由文件夹中,前端应用程序在我的后端应用程序的子文件夹 ClientApp 中。 Here are the screenshots of everything:以下是所有内容的截图:
UserForRegisterDTO: UserForRegisterDTO:
What am I getting wrong here?我在这里弄错了什么?
EDIT: Out of some reason, I can see every folder in my namespace when I start typing but ClientApp.编辑:出于某种原因,当我开始输入时,我可以看到命名空间中的每个文件夹,但 ClientApp. Here's the screenshot:这是屏幕截图:
If you check your IDE, it clearly shows that it cannot find DatingApp.SPA.ClientApp
namespace.如果您检查您的 IDE,它清楚地表明它找不到DatingApp.SPA.ClientApp
命名空间。
Open your UserForRegisterDTO.cs
file and check which namespace it is in. Then add that namespace instead of the one causing the issue.打开您的UserForRegisterDTO.cs
文件并检查它所在的命名空间。然后添加该命名空间而不是导致问题的命名空间。
If you are using Visual Studio (and it looks like you are), go with the cursor to the place in the method where UserForRegisterDTO
type is underlined and press Ctrl +.
如果您使用的是 Visual Studio(看起来像您),请将 go 和 cursor 移至方法中UserForRegisterDTO
类型带有下划线的位置,然后按Ctrl +.
. . It suggest ways of fixing this error, most probably automatically telling you which namespace is missing.它建议修复此错误的方法,很可能会自动告诉您缺少哪个名称空间。
If neither works, please update your question with more details.如果两者都不起作用,请使用更多详细信息更新您的问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.