Per Selvin’s comment what you probably DON’T want to modify is:
dotnet\sdk\VERSION\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.CSharp.props
which serves as the base source for the auto-generated usings file:
<!-- Implicit imports -->
<ItemGroup Condition="'$(ImplicitUsings)' == 'true' Or '$(ImplicitUsings)' == 'enable'">
<Using Include="System" />
<Using Include="System.Collections.Generic" />
<Using Include="System.IO" />
<Using Include="System.Linq" />
<Using Include="System.Net.Http" Condition="'$(TargetFrameworkIdentifier)' != '.NETFramework'"/>
<Using Include="System.Threading" />
<Using Include="System.Threading.Tasks" />
</ItemGroup>
However, your code will have issues when you
- Upgrade the SDK on your machine
- Try to build it on another machine where you haven’t manually modified the SDK files
The the recommended alternative is a “specifically named” GlobalUsings.cs
file that you just copy-paste to new projects where you put those extra usings:
global using System.Diagnostics;