That is because of global/implicit using. They are automatically generated by the build system.
Example:
global using global::System;
They could really be in an C# file of the project, but the default that the project system generates is in a file called <projectdir>\obj\<Release|Debug>\<tfm>\<projectname>.GlobalUsings.g.c
. So in a project called ConsoleApp1.csproj
, targeting .NET 6.0, in Release mode, the file is obj\Release\net6.0\ConsoleApp1.GlobalUsings.g.cs
.
You can view the file using Windows Explorer, or show all files in Visual Studio.
Example:

For a standard console project, the content of the file is:
// <auto-generated/>
global using global::System;
global using global::System.Collections.Generic;
global using global::System.IO;
global using global::System.Linq;
global using global::System.Net.Http;
global using global::System.Threading;
global using global::System.Threading.Tasks;
Those are defined by MSBuild files, by the Using
item group:
<ItemGroup>
<Using Include="System.Collections.Generic"/>
...
</ItemGroup>
So you could add your own namespaces if you like.
To disable implicit global usings, that is the generation of the <projectname>.GlobalUsings.g.cs
file, set the ImplicitUsings
property to disable
in your csproj file:
<PropertyGroup>
<ImplicitUsings>disable</ImplicitUsings>
</PropertyGroup>
Make sure to rebuild (or clean) your project after that change, because the originally generated file would otherwise still linger around.