I have a C# ASP.NET Core Project that I want to write tests for. However, for some strange reason the test project does not find the namespaces (and thus also the classes) of the project that I want to test. This notably happens even though I clearly have the main project referenced. How can this be?
The specific error I get is:
The type or namespace name 'DeviceWebDisplay' could not be found (are you missing a using directive or an assembly reference?)
As mentioned before, this happens even though I did add the project reference to DeviceWebDisplay. In fact, VisualStudio even offers me the quick action "Add reference to 'DeviceWebDisplay'". However, regardless of whether I've already added this or not, clicking that quick action doesn't have any effect.
Does anyone have any idea what caused this? For reference, here's the templates I used for the two projects:
- DeviceWebDisplay: ASP.NET Core Web App
- DeviceWebDisplayTest: Unit Test Project (.NET Framework)
EDIT:
I figured it might be the Target framework of the test project, but for some reason that one only goes up to 6.0, and the download website (that I get to when I click "Install other frameworks...") does not offer any SDKs for Visual Studio 2022.
And the thing is, my visual studio clearly has .NET 6.0 installed, or otherwise I wouldn't be able to use it in my main project.
Could it maybe be that I need to use a different template for the test project?


