BlazorInteropGenerator.SourceGenerator
1.0.0-alpha.8
dotnet add package BlazorInteropGenerator.SourceGenerator --version 1.0.0-alpha.8
NuGet\Install-Package BlazorInteropGenerator.SourceGenerator -Version 1.0.0-alpha.8
<PackageReference Include="BlazorInteropGenerator.SourceGenerator" Version="1.0.0-alpha.8" />
paket add BlazorInteropGenerator.SourceGenerator --version 1.0.0-alpha.8
#r "nuget: BlazorInteropGenerator.SourceGenerator, 1.0.0-alpha.8"
// Install BlazorInteropGenerator.SourceGenerator as a Cake Addin #addin nuget:?package=BlazorInteropGenerator.SourceGenerator&version=1.0.0-alpha.8&prerelease // Install BlazorInteropGenerator.SourceGenerator as a Cake Tool #tool nuget:?package=BlazorInteropGenerator.SourceGenerator&version=1.0.0-alpha.8&prerelease
BlazorInteropGenerator
What is this?
This project contains code and a Source Generator which can convert a TypeScript Definition to C# Interfaces.
How to use the Source Generator
Create a C# Class Library Project. Add the *.d.ts files that you want converted, also download all the dependencies. File names should be the {PackageName}.d.ts without the Organization/. Update the .csproj with the following settings.
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<LangVersion>latest</LangVersion>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="BlazorInteropGenerator.SourceGenerator" Version="1.0.0-*" OutputItemType="Analyzer" ReferenceOutputAssembly="false" />
<AdditionalFiles Include="*.d.ts" />
</ItemGroup>
</Project>
Create a .cs file with this format, in this case, the TypeScript Definition must contain an interface called "InterfaceName" The Source Generator will generate the interface and all its dependencies.
using BlazorInteropGenerator;
namespace BlazorInteropGenerator.Sample;
[BlazorInteropGenerator("TSD1.d.ts")]
public partial interface InterfaceName
{
}
Learn more about Target Frameworks and .NET Standard.
-
.NETStandard 2.0
- BlazorInteropGenerator (>= 1.0.0-alpha.8)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated | |
---|---|---|---|
1.0.0-alpha.8 | 232 | 11/15/2023 | |
1.0.0-alpha.7 | 78 | 9/21/2023 | |
1.0.0-alpha.6 | 84 | 9/18/2023 | |
1.0.0-alpha.5 | 99 | 9/13/2023 | |
1.0.0-alpha.4 | 75 | 9/11/2023 | |
1.0.0-alpha.3 | 85 | 9/7/2023 | |
1.0.0-alpha.2 | 88 | 9/7/2023 | |
1.0.0-alpha.1 | 101 | 9/7/2023 |