AdaskoTheBeAsT.Typewriter.CodeModel 4.17.0

dotnet add package AdaskoTheBeAsT.Typewriter.CodeModel --version 4.17.0
                    
NuGet\Install-Package AdaskoTheBeAsT.Typewriter.CodeModel -Version 4.17.0
                    
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="AdaskoTheBeAsT.Typewriter.CodeModel" Version="4.17.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="AdaskoTheBeAsT.Typewriter.CodeModel" Version="4.17.0" />
                    
Directory.Packages.props
<PackageReference Include="AdaskoTheBeAsT.Typewriter.CodeModel" />
                    
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 AdaskoTheBeAsT.Typewriter.CodeModel --version 4.17.0
                    
#r "nuget: AdaskoTheBeAsT.Typewriter.CodeModel, 4.17.0"
                    
#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 AdaskoTheBeAsT.Typewriter.CodeModel@4.17.0
                    
#: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=AdaskoTheBeAsT.Typewriter.CodeModel&version=4.17.0
                    
Install as a Cake Addin
#tool nuget:?package=AdaskoTheBeAsT.Typewriter.CodeModel&version=4.17.0
                    
Install as a Cake Tool

🧩 Typewriter CodeModel

CodeModel contracts, configuration types, and helper extension methods for Typewriter .tst templates, #load C# helper files, and external template helper libraries.

✨ What is included

  • Typewriter.CodeModel (File, Class, Record, Struct, Interface, Enum, EnumValue, Delegate, Method, Property, Parameter, Field, Constant, Event, Attribute, AttributeArgument, DocComment, Type, TypeParameter, collections, and NameCase helpers)
  • Typewriter.Configuration (Settings, PartialRenderingMode, DateLibrary)
  • Typewriter.Extensions.Documentation (DocCommentExtensions)
  • Typewriter.Extensions.Types (TypeExtensions)
  • Typewriter.Extensions.WebApi (HttpMethodExtensions, RequestDataExtensions, UrlExtensions)
  • Typewriter.VisualStudio (ILog, NullLog)

🚀 Referencing without conflicts

Typewriter's CLI and language server already load Typewriter.CodeModel in the template host. Follow the patterns below so IDE IntelliSense works in your helper .cs files without shipping unnecessary runtime DLLs or causing duplicate-assembly (CS0433) conflicts.

1. Reference as a compile-only dependency (PrivateAssets="all" + ExcludeAssets="runtime")

Add the package with PrivateAssets="all" and ExcludeAssets="runtime" so it is available to the IDE and compiler for IntelliSense, does not flow transitively to downstream projects, and is not copied into your application's runtime bin output:

<ItemGroup>
  <PackageReference Include="AdaskoTheBeAsT.Typewriter.CodeModel" Version="4.17.0" PrivateAssets="all" ExcludeAssets="runtime" />
</ItemGroup>

2. Using #load C# helper files vs #r helper assemblies

When a .tst template uses #load "TemplateHelpers.cs", Typewriter splices the body of TemplateHelpers.cs directly into the generated TypewriterTemplateHost class.

Because #load files often contain bare methods (such as string ToCustomName(Class c) => ...;) rather than a top-level class declaration, compiling bare methods directly inside a standard .csproj will fail with C# compiler errors (CS0116 / CS8803).

Choose one of the following patterns to get full IDE IntelliSense on Typewriter.CodeModel types without breaking your build:

  • Option A — Conditional #if !TYPEWRITER class wrapper (recommended for #load helper files): Typewriter automatically defines the TYPEWRITER preprocessor symbol when compiling .tst templates and #load files. Wrap your bare helper methods in #if !TYPEWRITER ... #endif with a partial class so multiple #load files compile cleanly inside a standard .csproj without requiring any custom <DefineConstants> or thin .tst wrapper methods:

    // templates/_helpers/ModelHelpers.cs
    using Typewriter.CodeModel;
    
    #if !TYPEWRITER
    public partial class _
    {
    #endif
        public string CustomTypeName(Class c) => $"I{c.Name}Dto";
    #if !TYPEWRITER
    }
    #endif
    

    Then load and use the helper directly in your .tst template:

    ${
        #load "_helpers/ModelHelpers.cs"
    }
    $Classes[$CustomTypeName]
    
  • Option B — Static class inside #load with thin template wrappers: Write a static class inside your .cs helper file so it compiles cleanly as valid C# in any project that references AdaskoTheBeAsT.Typewriter.CodeModel:

    // templates/_helpers/ModelHelpers.cs
    using Typewriter.CodeModel;
    
    static class ModelHelpers
    {
        public static string GetCustomTypeName(Class c) => $"I{c.Name}Dto";
    }
    

    Because #load splices static class ModelHelpers as a nested class inside the template host, expose a one-line wrapper method in the template (or at the bottom of the #load file if excluded from Compile):

    ${
        #load "_helpers/ModelHelpers.cs"
        string CustomTypeName(Class c) => ModelHelpers.GetCustomTypeName(c);
    }
    
  • Option C — Compiled helper class library with #r (recommended for large or unit-tested helpers): Put your helper methods in a public static class inside a dedicated helper project (netstandard2.0 or net10.0) that references AdaskoTheBeAsT.Typewriter.CodeModel with PrivateAssets="all" ExcludeAssets="runtime":

    using Typewriter.CodeModel;
    
    namespace MyProject.TypewriterHelpers;
    
    public static class ModelHelpers
    {
        public static string GetCustomTypeName(Class c) => $"I{c.Name}Dto";
    }
    

    Then reference the compiled helper assembly from your .tst template:

    ${
        #r "bin/Release/netstandard2.0/MyProject.TypewriterHelpers.dll"
        using MyProject.TypewriterHelpers;
    
        string CustomTypeName(Class c) => ModelHelpers.GetCustomTypeName(c);
    }
    
  • Option D — Bare #load methods excluded from the application build: If TemplateHelpers.cs contains bare methods without a wrapping class or #if !TYPEWRITER guard, exclude the template helper folder from Compile in your application .csproj so dotnet build ignores it while the project still holds the AdaskoTheBeAsT.Typewriter.CodeModel package reference:

    <ItemGroup>
      <PackageReference Include="AdaskoTheBeAsT.Typewriter.CodeModel" Version="4.17.0" PrivateAssets="all" ExcludeAssets="runtime" />
      <Compile Remove="templates/**/*.cs" />
      <None Include="templates/**/*.cs" />
    </ItemGroup>
    

3. Do not #r this package inside .tst templates

Do not add #r "nuget: AdaskoTheBeAsT.Typewriter.CodeModel" or #r "Typewriter.CodeModel.dll" inside .tst files. The Typewriter engine and language server automatically reference the host's Typewriter.CodeModel assembly and import the default Typewriter.* namespaces for every template.

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.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETStandard 2.0

    • 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
4.17.0 0 11/23/2026
4.16.0 87 11/8/2026