简体   繁体   English

Visual Studio - Intellisense 无法识别同一解决方案中另一个项目中的命名空间

[英]Visual Studio - Intellisense not recognizing namespace in another project within same solution

I have a solution consisting of two projects.我有一个由两个项目组成的解决方案。

The first project is Project.api, while the second is Project.models within C# .NET (webapi) solution.第一个项目是 Project.api,而第二个项目是 C# .NET (webapi) 解决方案中的 Project.models。 I can not get test.models to be recognized when pointing to it via using test.models;通过using test.models;指向它时,我无法识别using test.models; at the top of one of my classes.在我的一堂课中名列前茅。

What do I need to do to get the api project to not show red underline under the .models namespace?我需要做什么才能让 api 项目在 .models 命名空间下不显示红色下划线?

I have tried to re assign asp.net version from 4.5.2 to 4.0, and included references to Project.models under Project.api without success.我试图将 asp.net 版本从 4.5.2 重新分配到 4.0,并在 Project.api 下包含对 Project.models 的引用,但没有成功。

How can I get past this intellisense issue?我怎样才能解决这个智能感知问题?

Please see Solution Explorer screenshot.请参阅解决方案资源管理器屏幕截图。 Root namespace renamed.根命名空间已重命名。

解决方案资源管理器截图

For anyone reading this in 2020, a fix that I've found that has worked for me is cleaning the solution and unloading the projects that have dependencies such as a web API depending on a data project and an application project, then reloading and building each project in the order of dependence such that they build successfully.对于在 2020 年阅读本文的任何人,我发现对我有用的修复程序是清理解决方案并卸载具有依赖项的项目,例如依赖于数据项目和应用程序项目的 Web API,然后重新加载和构建每个按依赖顺序进行项目,以便它们成功构建。

Unloading projects: right click on the project in solution explorer and find "Unload Project"卸载项目:在解决方案资源管理器中右键单击项目并找到“卸载项目”

Reloading Projects: right click on the unloaded project in solution explorer and find "Reload Project"重新加载项目:在解决方案资源管理器中右键单击已卸载的项目并找到“重新加载项目”

so in my case my data project does not depend on any other project so I first reloaded and built that project, next the application project which depends on the data project and finally the web API project which depended on both data and application.所以就我而言,我的数据项目不依赖于任何其他项目,所以我首先重新加载并构建了该项目,然后是依赖于数据项目的应用程序项目,最后是依赖于数据和应用程序的 Web API 项目。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Visual Studio,在同一解决方案文件中调用另一个项目的Debug项目 - Visual Studio, Debug project that calls another project within the same solution file 为什么我不能在同一解决方案中的另一个项目中引用另一个命名空间中的类? - Why can't I reference a class in another namespace in another project within the same solution? 在Visual Studio中的相同解决方案中引用项目 - Referencing a Project in the Same Solution in Visual Studio Visual Studio for Mac:日志在一个项目上工作并显示在Azure上,但在相同解决方案的另一个项目上失败 - Visual Studio for Mac: Logs work on a Project and are shown on Azure, but fail on another Project of same Solution 在 Visual Studio (2019) 中调试单元测试项目时,在同一解决方案中运行另一个项目 - Run another project in the same solution while debugging unit test project in visual studio (2019) 如何在同一解决方案中执行另一个项目? - How to execute another project within the same solution? VS2010:使用解决方案中另一个项目的命名空间? - VS2010: Use namespace from another project within the solution? Visual Studio 2010无法识别命名空间ASP - Visual Studio 2010 is not recognizing namespace asp Visual Studio工具箱不包含来自同一解决方案的另一个项目的用户控件 - Visual Studio Toolbox Not Including User Controls from Another Project from Same Solution 从 Visual Studio 2019 中的 C# 解决方案返回 cmake 项目时,Resharper 智能感知停止工作 - when going back to cmake project from C# solution in visual studio 2019 Resharper intellisense stops working
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM