Skip to content

Latest commit

 

History

History
140 lines (106 loc) · 6.21 KB

File metadata and controls

140 lines (106 loc) · 6.21 KB

Template DotNet Tool

GitHub forks GitHub stars GitHub contributors License Build Quality Gate Security NuGet

DEMA Consulting template project for DotNet Tools, demonstrating best practices for building command-line tools with .NET.

Features

This template demonstrates:

  • Standardized Command-Line Interface: Context class handling common arguments (--version, --help, --silent, --validate, --results, --log)
  • Self-Validation: Built-in validation tests with TRX/JUnit output
  • Multi-Platform Support: Builds and runs on Windows and Linux
  • Multi-Runtime Support: Targets .NET 8, 9, and 10
  • Comprehensive CI/CD: GitHub Actions workflows with quality checks, builds, and integration tests
  • Linting Enforcement: markdownlint, cspell, and yamllint enforced on every CI run
  • Continuous Compliance: Compliance evidence generated automatically on every CI run, following the Continuous Compliance methodology
  • SonarCloud Integration: Quality gate and security analysis on every build
  • Documentation Generation: Automated build notes, user guide, code quality reports, requirements, justifications, and trace matrix
  • Requirements Traceability: Requirements linked to passing tests with auto-generated trace matrix

Installation

Install the tool globally using the .NET CLI:

dotnet tool install -g DemaConsulting.TemplateDotNetTool

Usage

# Display version
templatetool --version

# Display help
templatetool --help

# Run self-validation
templatetool --validate

# Save validation results
templatetool --validate --results results.trx

# Silent mode with logging
templatetool --silent --log output.log

Command-Line Options

Option Description
-v, --version Display version information
-?, -h, --help Display help message
--silent Suppress console output
--validate Run self-validation
--results <file> Write validation results to file (TRX or JUnit format)
--log <file> Write output to log file

Self Validation

Running self-validation produces a report containing the following information:

# DEMA Consulting Template DotNet Tool

| Information         | Value                                              |
| :------------------ | :------------------------------------------------- |
| Tool Version        | <version>                                          |
| Machine Name        | <machine-name>                                     |
| OS Version          | <os-version>                                       |
| DotNet Runtime      | <dotnet-runtime-version>                           |
| Time Stamp          | <timestamp> UTC                                    |

✓ TemplateTool_VersionDisplay - Passed
✓ TemplateTool_HelpDisplay - Passed

Total Tests: 2
Passed: 2
Failed: 0

Each test in the report proves:

  • TemplateTool_VersionDisplay - --version outputs a valid version string.
  • TemplateTool_HelpDisplay - --help outputs usage and options information.

See the User Guide for more details on the self-validation tests.

On validation failure the tool will exit with a non-zero exit code.

Documentation

Generated documentation includes:

  • Build Notes: Release information and changes
  • User Guide: Comprehensive usage documentation
  • Code Quality Report: CodeQL and SonarCloud analysis results
  • Requirements: Functional and non-functional requirements
  • Requirements Justifications: Detailed requirement rationale
  • Trace Matrix: Requirements to test traceability

License

Copyright (c) DEMA Consulting. Licensed under the MIT License. See LICENSE for details.

By contributing to this project, you agree that your contributions will be licensed under the MIT License.