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
}
}
Written by lukas
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Powershell
Authors
Related Tags
#powershell
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#