CSharpier can be run when a project is built by installing the CSharpier.MSBuild nuget package
By default this will
- In Debug - on build will run
dotnet csharpierin the project folder to format all files in the project.
- In Release - on build will run
dotnet csharpier --checkin the project folder to validate that all files in the project have already been formatted.
You can control when
--check is used with the following Property
You can bypass running CSharpier using the
dotnet publish -c release -o /app --no-restore /p:CSharpier_Bypass=true
You can control the value passed to
--loglevel with the following Property
Valid options are:
- Information (default)
CSharpier.MSBuild will be run with net6.0 or net7.0 if the project targets one of the two frameworks. In cases where the project targets something else (net48, netstandard2.0)
CSharpier_FrameworkVersion will default to net7.0
This can be controlled with the following property. This property is required if the csproj is targeting < net6.0 (netstandard2.0, net48, etc) and net7.0 is not installed.