0

I am currently working with VSCode on Windows. I have one folder opened in my workspace which contains several projects. Since we build the projects for net8.0 AND net481, I use the setting "dotnet.preferCSharpExtension": true for my workspace. I have not changed any other settings (neither for user, workspace or folder). I have C# extension v2.39.29 installed.

In my test projects, which use MSTest, I can click the little buttons Run all tests/Debug all tests/Run test/Debug test and they work - i.e. after clicking them the projects needed for these tests are built, then the tests are run/debugged.

In order to nail down some issue, I wanted to make a copy of a given test project, then remove content subsequentially. So I copied the test project folder, put it in the main folder, gave it a new name. I can run the new test project with dotnet test. But when I click any of the little buttons Run all tests/Debug all tests/Run test/Debug test, I just get the output

Error: Unable to get working directory for project Miscellaneous Files - file RunTestsHandler.cs line 124

in my .NET Test log.

I already tried restarting the language server, closing and reopening VScode, restarting Windows, uninstalling and reinstalling C# Dev Kit. None helped.

What else can I do?


I noticed that the colors in the code differ between the working test project (left) and the new non-working one (right). I can hover over the greenish text and get some popup. In the non-working one I have less greenish text. This indicates that something was not loaded.

left: working, right: non-working

1 Answer 1

2

I had to update my .sln file. After adding the new project to it and restarting language server, everything was loaded and worked.

See also github.

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

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.