Skip to main content

Blazor Interop Generation Tool Release

28 Jul 2020 - Cody Merritt Anhorn

This article is the Release post of my new Blazor Interop Generation Tool! Here I will do a quick overview of the tool and how to use it.

Overview

This tool allows for the easy creation of Blazor TypeScript Interop Generated projects, I packaged up my own library into an convince tool with ease of use features built in. By giving the CLI command a few flags you can generate a project with just a single command, no external files necessary.

Install

Below you can install the, it was built in .NET Core 5.0, so having the SDK installed is required.

dotnet tool install -g EventHorizon.Blazor.TypeScript.Interop.Tool

Command Line Options

I pulled the below table from the Tool’s Readme in GitHub, check out the readme to see current supported options.

Identifier Details Required/Default
-s, –source <source> TypeScript Definition to generate from, can be a File or URL, accepts multiple or as Array REQUIRED
-c, –class-to-generate <class-to-generate> A Class to generate, accepts multiple or as Array REQUIRED
-a, –project-assembly <project-assembly> The project name of the Assembly that will be generated Default: “Generated.WASM”
-l, –project-generation-location <project-generation-location> The directory where the Generated Project assembly will be saved Default: “_generated”
-f, –force This will force generation, by deleting –project-generation-location Default: (False)

Usage

The example below shows off a command that will generate a BabylonJS project, it takes in multiple sources from the internet and multiple classes to generate.

# ehz-generate -f -a Blazor.BabylonJS.WASM.Generated
# -s https://raw.githubusercontent.com/BabylonJS/Babylon.js/master/dist/babylon.d.ts
# -s https://raw.githubusercontent.com/BabylonJS/Babylon.js/master/dist/gui/babylon.gui.d.ts
# -c Button -c MeshBuilder -c PointLight
# -c StandardMaterial -c HemisphericLight
# -c UniversalCamera -c Grid -c StackPanel
ehz-generate -f -a Blazor.BabylonJS.WASM.Generated -s https://raw.githubusercontent.com/BabylonJS/Babylon.js/master/dist/babylon.d.ts -s https://raw.githubusercontent.com/BabylonJS/Babylon.js/master/dist/gui/babylon.gui.d.ts -c Button -c MeshBuilder -c PointLight -c StandardMaterial -c HemisphericLight -c UniversalCamera -c Grid -c StackPanel

Categories: blog blazor

Tags: .NET Core Blazor WASM


Cody Merritt Anhorn
Email: cody.anhorn@hotmail.com