A collection of default settings for new C# .NET repositories
- .editorconfig and .gitattributes from Roslyn
- .gitignore adapted from GitHub Visual Studio
- Global C# language version and Nullable configuration using Directory.Build.props
- Minimum .NET SDK version using global.json
- StyleCop configuration to match
.editorconfig
You can find example project configurations in the test branch.
Add the StyleCop.Analyzers NuGet package to your project. Then add the following to your .csproj file:
<ItemGroup>
<AdditionalFiles Include="..\..\stylecop.json">
<Link>CodeStyle\stylecop.json</Link>
</AdditionalFiles>
</ItemGroup>
<ItemGroup>
<Compile Include="..\..\GlobalSuppressions.cs">
<Link>CodeStyle\GlobalSuppressions.cs</Link>
</Compile>
</ItemGroup>
The above assumes your directory structure to be like src/my-project
.
<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
</PropertyGroup>
<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<NoWarn>$(NoWarn),1573,1591,1712</NoWarn>
</PropertyGroup>