0

In Visual Studio, I right click on the project I want to add a class to, click 'Add' -> 'Class...', and when the class gets created, instead of the class associated with the right project(https://i.stack.imgur.com/o1zMD.png), it just gets associated with 'Miscellaneous Files'(https://i.stack.imgur.com/IUsGe.png). I'm assuming this is why it doesn't recognize any of the packages I'm trying to use that it recognizes just fine for other classes(https://i.stack.imgur.com/rNLDt.png). Why is this, and how do I get Visual Studio to associate new classes with the correct project?

I tried the top 7 answers on this question: Visual Studio - project shows up as "Miscellaneous Files". I was going to try the 8th answer, but Visual Studio won't let me open my .csproj file.

1 Answers1

0

Files appearing in "Miscellaneous files" can have many causes. The most common of which is a failing "design time build", which is a build that VS performs behind the scene that doesn't produce a compiled output, but does produce the information about your project that VS needs to work. When that build fails, lots of scenarios inside of VS can degrade as you see here.

You don't say what kind of project you have, and it's not possible to tell from your screenshot. One way to diagnose design-time build failures is described here: https://github.com/dotnet/project-system-tools

By obtaining a log of the design-time build, you will be able to see why the failure occurred and take steps to address it.

Drew Noakes
  • 300,895
  • 165
  • 679
  • 742