Reputation: 1841
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. I can not get test.models to be recognized when pointing to it via 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?
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.
How can I get past this intellisense issue?
Please see Solution Explorer screenshot. Root namespace renamed.
Upvotes: 1
Views: 2940
Reputation: 621
What has worked for me is to delete all the bin
and obj
folders from all the projects in a solution. I'm not 100% sure, but I think that visual studio caches stuff in obj folders and then might take something from there and even rebuild doesn't help as cleaning deletes only bin
folder, but doesn't touch obj
.
Upvotes: 0
Reputation: 1193
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.
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.
Upvotes: 4