Xunit namespace not found in Visual Studio Code
I am using Visual Studio Code for .NET Core Project. I have a basic ASP.NET project for which I want to create a separate modules project, I created a subfolder and ran
dotnet new xunit
dotnet restore
When I tried to run it from the "dotnet build" cli "dotnet run" it worked successfully, however in visual studio it says it cannot find the Xunit namespace
This is very strange because the Visual Studio Code has worked for me so far, it never had dependency problems, it only has this Xunit problem.
Anyone familiar with this problem?
source to share
I tried to open the test project directly with vscode (instead of opening the root project containing the test project in a subfolder) and now vscode recognizes Xunit.
Then I reopened the root project with vscode, added Xunit to the root project's csproj file, ran a "dotnet" restore on the root project, and now Xunit is recognized in the test project.
The thing is, vscode (or is it Omnisharp? I'm not sure) probably only looks at the root csproj file and ignores any csproj file that is in a subfolder.
source to share