SharpTS.Sdk 1.0.9

There is a newer version of this package available.
See the version list below for details.
dotnet add package SharpTS.Sdk --version 1.0.9
                    
NuGet\Install-Package SharpTS.Sdk -Version 1.0.9
                    
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="SharpTS.Sdk" Version="1.0.9">
  <PrivateAssets>all</PrivateAssets>
  <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="SharpTS.Sdk" Version="1.0.9" />
                    
Directory.Packages.props
<PackageReference Include="SharpTS.Sdk">
  <PrivateAssets>all</PrivateAssets>
  <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
                    
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 SharpTS.Sdk --version 1.0.9
                    
#r "nuget: SharpTS.Sdk, 1.0.9"
                    
#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.
#:package SharpTS.Sdk@1.0.9
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=SharpTS.Sdk&version=1.0.9
                    
Install as a Cake Addin
#tool nuget:?package=SharpTS.Sdk&version=1.0.9
                    
Install as a Cake Tool

SharpTS.Sdk

MSBuild SDK for compiling TypeScript directly to .NET assemblies using SharpTS.

SharpTS.Sdk composes with the installed Microsoft.NET.Sdk and uses the compiler bundled in the selected package version. It does not require a global sharpts tool installation.

Quick Start

Create a new project file:

<Project Sdk="SharpTS.Sdk/1.0.7">
  <PropertyGroup>
    <TargetFramework>net10.0</TargetFramework>
    <SharpTSEntryPoint>src/main.ts</SharpTSEntryPoint>
  </PropertyGroup>
</Project>

Build your project:

dotnet build

Features

  • Compiles TypeScript directly to .NET IL (no JavaScript intermediate)
  • Automatic import discovery via ModuleResolver
  • tsconfig.json integration
  • Optional TypeScript .d.ts declaration output
  • Standard MSBuild commands (dotnet build, dotnet clean)
  • MSBuild-compatible error output for IDE integration

MSBuild Properties

Property Description Default
SharpTSEntryPoint Entry point TypeScript file (required) (none)
SharpTSOutputPath Output directory for compiled DLL $(OutputPath)
SharpTSOutputFileName Output filename $(AssemblyName).dll
SharpTSTsConfigPath Path to tsconfig.json $(MSBuildProjectDirectory)\tsconfig.json
SharpTSPreserveConstEnums Preserve const enum declarations false
SharpTSExperimentalDecorators Enable legacy (Stage 2) decorators false
SharpTSDecorators Enable TC39 Stage 3 decorators false
SharpTSEmitDecoratorMetadata Emit decorator metadata false
SharpTSGenerateDeclarations Emit TypeScript declarations false
SharpTSEmitDeclarationOnly Emit declarations without a .NET assembly false
SharpTSDeclarationDir Declaration output directory (source/outDir default)
SharpTSVerifyIL Verify generated IL false
SharpTSUseReferenceAssemblies Use reference assembly mode false

tsconfig.json Integration

The SDK automatically reads tsconfig.json if present. The MSBuild task extracts:

tsconfig.json Maps to
compilerOptions.preserveConstEnums SharpTSPreserveConstEnums
compilerOptions.experimentalDecorators SharpTSExperimentalDecorators
compilerOptions.decorators SharpTSDecorators
compilerOptions.emitDecoratorMetadata SharpTSEmitDecoratorMetadata
compilerOptions.declaration SharpTSGenerateDeclarations
compilerOptions.emitDeclarationOnly SharpTSEmitDeclarationOnly
compilerOptions.declarationDir SharpTSDeclarationDir
files[0] SharpTSEntryPoint (if not set)

MSBuild properties take precedence over tsconfig.json values.

The compiler also receives the config through --project, so extends, strictness, baseUrl/paths, selectable moduleResolution, and lib/types/typeRoots use the same project model as the CLI. files[0] remains the default runtime entry point for SDK IL output; use sharpts -p or sharpts --build to type-check every files/include root.

Example Projects

Minimal Project

<Project Sdk="SharpTS.Sdk/1.0.7">
  <PropertyGroup>
    <TargetFramework>net10.0</TargetFramework>
    <SharpTSEntryPoint>src/main.ts</SharpTSEntryPoint>
  </PropertyGroup>
</Project>

With Decorators

<Project Sdk="SharpTS.Sdk/1.0.7">
  <PropertyGroup>
    <TargetFramework>net10.0</TargetFramework>
    <SharpTSEntryPoint>src/app.ts</SharpTSEntryPoint>
    <SharpTSDecorators>true</SharpTSDecorators>
    <SharpTSEmitDecoratorMetadata>true</SharpTSEmitDecoratorMetadata>
  </PropertyGroup>
</Project>

With tsconfig.json

Project structure:

myproject/
├── myproject.csproj
├── tsconfig.json
└── src/
    └── main.ts

myproject.csproj:

<Project Sdk="SharpTS.Sdk/1.0.7">
  <PropertyGroup>
    <TargetFramework>net10.0</TargetFramework>
    
  </PropertyGroup>
</Project>

tsconfig.json:

{
  "compilerOptions": {
    "target": "ES2020",
    "module": "ESNext",
    "strict": true,
    "preserveConstEnums": true
  },
  "files": ["src/main.ts"]
}

Version Specification

You can pin the SDK version in global.json:

{
  "msbuild-sdks": {
    "SharpTS.Sdk": "1.0.7"
  }
}

Build Commands

# Build the project
dotnet build

# Clean output files
dotnet clean

# Publish
dotnet publish

# Build in Release mode
dotnet build -c Release

Error Codes

Code Category Description
SHARPTS000 General Unclassified error
SHARPTS001 Type Error Type mismatch, invalid assignment
SHARPTS002 Parse Error Syntax error, unexpected token
SHARPTS003 Module Error Import not found, circular dependency
SHARPTS004 Compile Error IL emission failure
SHARPTS005 Config Error Invalid configuration

System Requirements

  • .NET 10 SDK or later (required for building projects)
  • Visual Studio 2026 18.0+ (recommended for IDE support)
  • MSBuild 18.0+ (included with .NET 10 SDK)

SharpTS.Sdk targets .NET 10 directly for optimal performance and modern features.

License

MIT License - see the main SharpTS repository for details.

There are no supported framework assets in this package.

Learn more about Target Frameworks and .NET Standard.

This package has no dependencies.

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.12 84 8/17/2026
1.0.11-rc.3 55 8/11/2026
1.0.11-rc.2 53 8/11/2026
1.0.11-rc.1 52 8/10/2026
1.0.9 93 8/10/2026
1.0.7 1,736 2/5/2026
1.0.6 143 1/23/2026
1.0.5 129 1/17/2026
1.0.4 138 1/11/2026
1.0.0 164 1/8/2026