It didn’t work with the .editorconfig, but I did this by updating the project file. When we add the NoWarn config, it’ll be ok.
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<UserSecretsId>.....</UserSecretsId>
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
<NoWarn>$(NoWarn),CA2254</NoWarn>
</PropertyGroup>