All rules
CA2266Usage Enabled by default: As warning
File-based program entry point should start with #!
File-based program entry point should start with #!
Microsoft docsDescription
For correct tool identification and direct shell execution support, start the entry point file with a shebang (#!) line to clearly distinguish it from files brought in with #:include or #:ref.
Cause
Your entry point file in a multi-file file-based program doesn't start with a shebang (#!) line.
How to fix violations
Add a shebang line to the beginning of the entry point file, for example, #!/usr/bin/env dotnet.
Example
#:include "helpers.cs"
Console.WriteLine(GetMessage());
string GetMessage() => "Hello";
#!/usr/bin/env dotnet
#:include "helpers.cs"
Console.WriteLine(GetMessage());
string GetMessage() => "Hello";When to suppress
If you intentionally omit the shebang line and have confirmed that your tooling can still identify the entry point correctly, it is safe to suppress this warning.
Your vote
Group results
0 yes 0 no
ConsensusNone (disabled)
Severity preference (yes voters)
Suggestion0
Warning0
Error0