dotnet / docs

This repository contains .NET Documentation.
https://learn.microsoft.com/dotnet
Creative Commons Attribution 4.0 International
4.17k stars 5.83k forks source link

Missing step in 'Create the solution' #41305

Open dadaPipes opened 4 weeks ago

dadaPipes commented 4 weeks ago

Type of issue

Missing information

Description

After running this command: dotnet new classlib -o PrimeService

It says the following: "The dotnet new classlib command creates a new class library project in the PrimeService folder. The new class library will contain the code to be tested."

When I look in Powershell I see that the project library is added, but it is not visible in VS 2022 solution explorer. The next step, "Rename Class1.cs to PrimeService.cs.", is then not possible to solve, because the proj library is not visible in solution explorer, so there is nothing to rename. What also means that I can not paste in the code snippet in the next step.

Now I looked at the page again and see that the missing step, I was looking for "dotnet sln add ./PrimeService/PrimeService.csproj" comes after "Rename Class1.cs to PrimeService.cs.".

Suggestion: Move "In the unit-testing-using-dotnet-test directory, run the following command to add the class library project to the solution: dotnet sln add ./PrimeService/PrimeService.csproj", up before, "Rename Class1.cs to PrimeService.cs." so I comes in the correct order.

Page URL

https://learn.microsoft.com/en-us/dotnet/core/testing/unit-testing-with-dotnet-test

Content source URL

https://github.com/dotnet/docs/blob/main/docs/core/testing/unit-testing-with-dotnet-test.md

Document Version Independent Id

422811cb-6287-03af-ba8d-1daebee9744d

Article author

@ardalis

Metadata

dadaPipes commented 4 weeks ago

In the https://learn.microsoft.com/en-us/dotnet/core/testing/unit-testing-with-dotnet-test#add-more-tests The tests wont work unless the solution is cleaned and rebuild first.

That would be a nice thing to add to the documentation, so one won't be stuck and wonder why it is not working.

It might be obvious for an experienced developer, but an unnecessary headache for a beginner.

rextor92 commented 3 weeks ago

Hey there this (and the other 2 articles for NUnit and MSTest) do not require Visual Studio and assume you're using the command line / VSCode. Using Visual Studio, it is true the file would not be visible in the solution explorer prior to adding the project to the solution and those steps will need to be swapped if you wanted to rename the file from the GUI.