My unit test project icon is displaying like a class library... how to fix?

  • Right-click the project in Solution Explorer and choose Edit Project File
  • Add a new child in the <PropertyGroup> node:

    <ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>

  • Save your changes and close the file

  • Right-click the project in Solution Explorer and choose Reload Project

https://adamprescott.net/2012/03/29/convert-a-class-library-to-a-test-project-in-visual-studio/


If your project is on a new-style .csproj file (less verbose, says like <Project Sdk="Microsoft.NET.Sdk"> as the top line, supports globbing etc), then you can get a test tube icon for your project by either adding Microsoft.NET.Test.Sdk NuGet package to your project, or adding this line to your .csproj file (which amounts to the same thing):

<ItemGroup>
    <PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.6.1" />
</ItemGroup>

(Version number correct at the time of writing - check for what the latest is.)