CSharpToTypescript2 1.1.2

There is a newer version of this package available.
See the version list below for details.
dotnet add package CSharpToTypescript2 --version 1.1.2
                    
NuGet\Install-Package CSharpToTypescript2 -Version 1.1.2
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="CSharpToTypescript2" Version="1.1.2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="CSharpToTypescript2" Version="1.1.2" />
                    
Directory.Packages.props
<PackageReference Include="CSharpToTypescript2" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add CSharpToTypescript2 --version 1.1.2
                    
#r "nuget: CSharpToTypescript2, 1.1.2"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#addin nuget:?package=CSharpToTypescript2&version=1.1.2
                    
Install CSharpToTypescript2 as a Cake Addin
#tool nuget:?package=CSharpToTypescript2&version=1.1.2
                    
Install CSharpToTypescript2 as a Cake Tool

This is documentation file for CSharpToTypescript2 nuget package.

Usage

The transpiler is not only nuget package by itself. You need to create runner console application in the solution where you want to use the tool with code:

using System;

namespace Cs2Ts
{
    class Program
    {
        static void Main(string[] args)
        {
            if (args.Length != 1)
            {
                Console.WriteLine(@"Please specify absolute path to config file as first argument");
                throw new ArgumentException();
            }
            CSharpToTypescript.Runner.Run(args[0]);
        }
    }
}

Configuration yaml file is needed like:

OutputDir: src\AspNetCoreSpa.Web\ClientApp\_Site\_TsDtos
InputDirs: 
    - src\AspNetCoreSpa.Core
    - src\AspNetCoreSpa.Web\ClientApp
InputFilesFilterRegex: .*DTOE?[.]cs$
TsHeader: |
    //Caution, this file is autogenerated by TsGenerator module. Don't change the file by hands.
    import { Gender, DateTimeOffset, ICollection, Dictionary, IEnumerable, IList, List, strEnum} from '../CsTypes';

Also you need to add build hook to your Web project file like:

<Target Name="GenerateTs1" AfterTargets="Build" Condition=" '$(Configuration)' == 'Debug' ">
	<Exec Command="echo Ts generation started." />
		<Exec Command="dotnet exec $(ProjectDir)..\Cs2Ts\$(OutDir)Cs2Ts.dll $(ProjectDir)..\..\csharptotypescript.yml" ConsoleToMSBuild="true">
			<Output TaskParameter="ConsoleOutput" PropertyName="OutputOfExec" />
		</Exec>
	<Exec Command="echo Ts generation started." />
</Target>
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  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.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed. 
.NET Core netcoreapp2.2 is compatible.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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.1.9 25,120 11/27/2022
1.1.8 1,092 12/21/2021
1.1.7 4,579 8/14/2020
1.1.6 1,291 8/13/2020
1.1.5 1,261 7/15/2020
1.1.4 1,351 3/18/2020
1.1.3 2,052 11/10/2019
1.1.2 1,309 11/10/2019
1.1.0 1,261 11/10/2019
0.7.2 1,336 10/27/2019
0.7.1 1,321 10/26/2019
0.7.0 1,302 10/26/2019

This is first working release. See that in work at https://github.com/alehro/AspNetCoreSpa