Search code examples
c#.netcsprojimplicit-usings

<ImplicitUsings> in .NET8 project, any vulnerabilities?


Using the upgrade-assistant provided by MS, i'm trying to upgrade my projects from .NET 6 to 8.

I have noticed this being inserted at the top of my project files : <ImplicitUsings>enabled</ImplicitUsings>

Inserted ImplicitUsings in csproj

Does <ImplicitUsings> provide any possible attack vector for my projects? I have a feeling that libraries can be hijacked this way.

Anyone have any information? Thanks!


Solution

  • No it won't cause any issues. Implicit usings allow you to remove a number of commonly used using statements from each file by referring to one location and you can customise it if you wish to through the csproj settings. It will generate a ProjectName.GlobalUsings.g.cs file with the following by default.

    Global usings