Mangh.Metrology.UnitGenerator 2.0.1

There is a newer version of this package available.
See the version list below for details.
dotnet tool install --global Mangh.Metrology.UnitGenerator --version 2.0.1                
This package contains a .NET tool you can call from the shell/command line.
dotnet new tool-manifest # if you are setting up this repo
dotnet tool install --local Mangh.Metrology.UnitGenerator --version 2.0.1                
This package contains a .NET tool you can call from the shell/command line.
#tool dotnet:?package=Mangh.Metrology.UnitGenerator&version=2.0.1                
nuke :add-package Mangh.Metrology.UnitGenerator --version 2.0.1                

Unit Generator for C# and C++

Description

  • Standalone dotnet tool for generating unit of measurement structures for C# or C++ languages from the console.

Installation

  • Install the tool as a "global tool":

    dotnet tool install --global Mangh.Metrology.UnitGenerator
    

    The tool is user-specific, not global to the machine (as you might think). It is only available to the user that installed the tool.

    NOTE: You can also install the tool as a "global tool in a custom location" or as a "local tool". If you do it, please amend the Usage instruction (below) accordingly. For details, see article "How to manage .NET tools". Don't forget to amend your scripts (e.g. CMakeLists.txt files) that make use of the tool.

Usage

  • Use the command line with the following syntax to run the tool:

    UnitGenerator targetLanguage targetNamespace templateFolder targetFolder [--with-models]
    

    where:

    targetLanguage  : CS | CPP.
    targetNamespace : namespace string, e.g.
                     "Demo.Metrology" for CS language,
                     "Demo::Metrology" for CPP language,
    templateFolder  : path to the folder containing definitions and templates,
    targetFolder    : path to the target folder for generated units and scales,
    --with-models   : request to save models in files (in the targetFolder)
    
  • Example use for C#:

    UnitGenerator CS "Demo.UnitsOfMeasurement" .\UnitsOfMeasurement\Templates .\UnitsOfMeasurement\Units
    
  • Example use for C++:

    UnitGenerator CPP "CALINE3::Metrology" Metrology/Templates Metrology/Units
    
  • The tool requires the following templates in the templateFolder directory:

    C# C++ purpose
    Definitions.txt definitions.txt units and scales definitions
    Unit.xslt unit.xslt unit template
    Scale.xslt scale.xslt scale template
    n/a math-constants.xslt math constants
    n/a replace-string.xslt replace function
    Catalog.xslt n/a catalog template
    Aliases.xslt n/a aliases template
    Report.xslt report.xslt report template

    Sample templates can be found on the project website.

Replaces

  • The package replaces the XsltGeneratorApp console application available in the source code of Mangh.Metrology version 1.x.
Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

This package has no dependencies.

Version Downloads Last updated
2.0.2 129 5/6/2024
2.0.1 169 4/3/2024
2.0.0 207 6/21/2023

Version 2.0.1
       * no functional changes, but all projects target .NET 8 (to improve performance).
       Version 2.x
       * C++ support (new),
       * source code heavily restructured,
       * packages renamed.
       Version 1.x (XsltGeneratorApp console application)
       * deprecated.