简体   繁体   English

命名空间中不存在类型或命名空间名称(是否缺少程序集引用?)- 无法引用 class

[英]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:以下是所有内容的截图:

AuthController:授权控制器: 授权控制器

UserForRegisterDTO: UserForRegisterDTO: 用户注册DTO

Solution Explorer:解决方案资源管理器: 解决方案资源管理器

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.

相关问题 类型或名称空间名称在名称空间中不存在“是否缺少程序集引用?” - The type or namespace name does not exist in the namespace ''are you missing an assembly reference ?" 命名空间中不存在类型或命名空间名称(您是否缺少程序集引用?) - The type or namespace name does not exist in the namespace (are you missing an assembly reference?) 错误 CS0234:命名空间“Microsoft”中不存在类型或命名空间名称“Azure”(您是否缺少程序集引用?) - error CS0234: The type or namespace name 'Azure' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?) 命名空间“System.Web”中不存在类型或命名空间名称“Mvc”(您是否缺少程序集引用?)Kentico - The type or namespace name 'Mvc' does not exist in the namespace 'System.Web' (are you missing an assembly reference?) Kentico 命名空间“Microsoft.SqlServer”中不存在类型或命名空间名称“Smo”(您是否缺少程序集引用?) - The type or namespace name 'Smo' does not exist in the namespace 'Microsoft.SqlServer' (are you missing an assembly reference?) 命名空间“MicrosoftSqlServer”中不存在类型或命名空间名称“Management”,您是否缺少程序集引用 - the type or namespace name 'Management' does not exist in the namespace 'MicrosoftSqlServer' are you missing an assembly reference CS0234 C#类型或名称空间名称'Slydeextender'在名称空间中不存在(您是否缺少程序集引用?) - CS0234 C# The type or namespace name 'Slydeextender' does not exist in the namespace (are you missing an assembly reference?) 命名空间“Android.Support.V4.App”中不存在类型或命名空间名称“TaskStackBuilder”(您是否缺少程序集引用?) - The type or namespace name 'TaskStackBuilder' does not exist in the namespace 'Android.Support.V4.App' (are you missing an assembly reference?) 命名空间“Microsoft.AspNetCore”中不存在类型或命名空间名称“Mvc”(您是否缺少程序集引用?) - The type or namespace name 'Mvc' does not exist in the namespace 'Microsoft.AspNetCore' (are you missing an assembly reference?) 错误:命名空间中不存在类型或命名空间名称“Interface”(是否缺少程序集引用) - Error: The type or namespace name 'Interface' does not exist in the namespace (are you missing an assembly reference)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM