nrc31w
Last Updated: February 25, 2016
·
96
· lukasz-madon
B2bc42f69510d6a1d2c9cde1c2214d24

Script to add <auto-generated> to generated files

# Script add "// <auto-generated />" to .cs files tosuppress StyleCop warning (e.g. Thrift generated)
# Usage: powershell -ExecutionPolicy ByPass -File "$(ProjectDir)AddAutoGenerateToFiles.ps1" "$(ProjectDir)Generated"
$autoGenerated = "// <auto-generated />"
Get-ChildItem -recurse $args[0] -Filter *.cs | Foreach-Object {
    $content = Get-Content $_.FullName
    if(!$content[0].StartsWith($autoGenerated)) {
        Set-Content -Path $_.FullName -Value $autoGenerated
        Add-Content -Path $_.FullName  -Value $content
    }
}
Say Thanks
Respond