1

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.

Solution Explorer Screenshot

13
  • Looking for some guidance, I have posted a general description from my app, omitting some details. I can post more if needed. Commented May 1, 2017 at 20:26
  • 1
    In Solution Explorer, right click on "References" under Project.api. Pick "Add Reference" on the context menu. In the dialog, click on "Solution" on the tree on the left and find the project you want under Projects. Add a reference to it. Commented May 1, 2017 at 20:27
  • Just tried it, all projects are checked, and after rebuild, unfortunately,the red squiggly line remains. Commented May 1, 2017 at 20:29
  • 1
    Done, please see screenshot. Commented May 1, 2017 at 22:16
  • 1
    Turns out, with the help of a colleague, my projects had some hidden syntax and type errors I got the issue cleared up. Commented May 2, 2017 at 0:09

2 Answers 2

4

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.

Sign up to request clarification or add additional context in comments.

Comments

0

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.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.