Skip to content

Instantly share code, notes, and snippets.

View sommmen's full-sized avatar

sommmen

View GitHub Profile
@sommmen
sommmen / add-nullable-disable.ps1
Last active March 15, 2024 15:06
Add nullable disable to all .cs files
# When enabling nullability globally withing a csproj file, you could get a lot of erros.
# This adds #nullable disable to all files so you may manually fix them.
# Just do a global search for '#nullable disable' in your IDE, remove the line and fix warnings and errors (EF core).
# TODO BUG this could change the file encoding of the file, UTF80 -> win1252 in my case.
[string] $directoryPath = ...
[switch] $dryRun = $true;
# Ensure the directory exists