C# target configuration

All fields belong under the selected target’s options object. Unknown fields are rejected.

OptionTypeDefaultContract
assemblyNamenonempty stringTsonicGeneratedFile-safe .NET assembly name
implicitUsingsbooleanfalseGenerated project ImplicitUsings
languageDialectcsharp14 or csharp15-previewcsharp14C# syntax/specification dialect
memorySafetyRulescsharp14 or previewcsharp14Independent C# memory-safety rules
namespacenonempty stringTsonic.GeneratedDot-separated C# identifier path
nullablebooleantrueGenerated project nullable context
outputTypeExe or LibraryLibraryGenerated project output kind
providerReferencesobjectemptyAssemblies available to .NET declaration reflection
projectFilenonempty stringnoneExisting user-owned .csproj
propertiesscalar objectemptyAdditional non-target-owned MSBuild properties
publishAotbooleanomittedGenerated PublishAot property when supplied
referencesobjectemptyGenerated native project references
targetFrameworknonempty stringnet10.0Generated target framework and framework-pack lookup

memorySafetyRules: "preview" requires languageDialect: "csharp15-preview".

Generated and user-owned projects

OptionGenerated projectUser-owned project
assemblyName, namespace, outputTypecontrols emitted C# and project identitystill controls emitted C# semantics where applicable
languageDialect, memorySafetyRulescontrols accepted/emitted C#same
targetFrameworkemits TargetFramework and selects the framework reference packselects the framework reference pack; the .csproj must agree
referencesemits project references; framework/assembly entries also feed reflectionnot written to the .csproj; framework/assembly entries may feed reflection
properties, implicitUsings, nullable, publishAotemitted into the generated projectnot written to the user project
providerReferencesreflection input onlyreflection input only
projectFileabsentselects the existing .csproj

Tsonic never edits a user-owned project. Configuration that belongs to that project—SDK selection, item inclusion, package restore, target RID, signing, and deployment—must be written in the .csproj.

references

FieldEntry shape
projectsnonempty project path strings
packages{ include, version?, privateAssets?, includeAssets? }
frameworksframework names such as Microsoft.AspNetCore.App
assemblies{ include, hintPath? }

Duplicate (kind, include) identities are rejected.

providerReferences

FieldMeaning
assembliesExplicit assembly paths, relative to the project directory or absolute
directoriesExisting directories whose sorted .dll files form reflection inputs

An empty or nonexistent provider directory is rejected. Duplicate canonical assembly paths are rejected.

properties

Names must be XML element names and values must be strings, numbers, or booleans. These target-owned properties cannot be overridden through properties:

AllowUnsafeBlocks, Features, ImplicitUsings, LangVersion, Nullable, OutputType, PublishAot, and TargetFramework.

Use the dedicated option instead. For example, set publishAot, not properties.PublishAot. The target may also enable AllowUnsafeBlocks when the sealed program contains an explicitly authorized unsafe requirement; a free-form property cannot bypass that analysis.

Complete generated example

{
  "id": "csharp",
  "surfaces": ["js"],
  "options": {
    "assemblyName": "Acme.Tool",
    "namespace": "Acme.Generated",
    "outputType": "Exe",
    "targetFramework": "net10.0",
    "languageDialect": "csharp14",
    "nullable": true,
    "references": {
      "frameworks": ["Microsoft.AspNetCore.App"],
      "packages": [{
        "include": "Microsoft.Extensions.Logging.Abstractions",
        "version": "10.0.0"
      }]
    },
    "properties": {
      "RuntimeIdentifier": "linux-x64",
      "SelfContained": true
    }
  }
}