I got this error when I set up a .NET Core 6 app:
Unhandled exception. System.IO.FileNotFoundException: Could not load file or assembly 'System.Diagnostics.PerformanceCounter, Version=8.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. The system cannot find the file specified.
I actually added the package reference. It just does not work.
<PackageReference Include="System.Diagnostics.PerformanceCounter" VersionOverride="8.0.0" />
According to your description, I suggest you could firstly make sure you have installed the System.Diagnostics.PerformanceCounter
8.0.0 from the nuget package.
You could also use this command :
dotnet add package System.Diagnostics.PerformanceCounter --version 8.0.0
But I suggest you could re-check your project to make sure your project's support version 8 System.Diagnostics.PerformanceCounter.
Its dependencies as below:
It need upgrade some package >=8.0.0
If your project doesn't support this, I suggest you could install the 6.0.1 instead of the 8.0.0.