ASP .NET 5 Support

Create issue
Issue #101 open
Former user created an issue

No description provided.

Comments (6)

  1. Stijn Herreman

    I've done some experimentation with an MSBuild Task (not for ASP.NET 5 but to avoid having to install T4 dependencies on the build server), and while it's possible after getting past some hurdles of MSBuild (assembly locking being a major one), it's not an ideal solution since you lose the possibility to run it on demand.

    The general gist of it is to create a separate class library with a task inheriting from AppDomainIsolatedTask to replace the generation part of the T4 template, and some Targets in the web csproj to call it:

        public class TypeLite
            : AppDomainIsolatedTask
            public string Properties { get; set; }
            public string Enums { get; set; }
            public override bool Execute()
                Log.LogMessage(MessageImportance.High, "Executing TypeLite");
                var types = ...; // collect the types here
                var ts = TypeScript.Definitions();
                types.ForEach(t => { ts = ts.For(t); });
                Log.LogMessage(MessageImportance.High, "Generating properties");
                this.Properties = ts.Generate(TsGeneratorOutput.Properties);
                Log.LogMessage(MessageImportance.High, "Generating enums");
                this.Enums = ts.Generate(TsGeneratorOutput.Enums);
                Log.LogMessage(MessageImportance.High, "TypeLite execution was successful");
                return true;
      <Target Name="TypeLite" Condition="$(ExecuteTypeLite)">
          <Output TaskParameter="Properties" PropertyName="Properties" />
          <Output TaskParameter="Enums" PropertyName="Enums" />
        <WriteLinesToFile File="$(ProjectDir)\typings\TypeLite.Properties.d.ts" Lines="$(Properties)" Overwrite="true" />
        <WriteLinesToFile File="$(ProjectDir)\typings\TypeLite.Enums.ts" Lines="$(Enums)" Overwrite="true" />
      <Target Name="TypeLiteWrapper" BeforeTargets="BeforeBuild">
        <Exec Command="&quot;$(MSBuildBinPath)\MSBuild.exe&quot; /t:TypeLite /p:ProjectDir=&quot;$(ProjectDir.Replace('\','\\'))&quot; /p:Configuration=$(Configuration) /p:ExecuteTypeLite=true &quot;$(ProjectDir)$(ProjectFileName)&quot;" />

    I think this isn't an adequate solution yet, but perhaps it can be improved upon.

  2. AugustoB

    Did somebody try this? I'm starting a new Asp.Net Core project and migrating some code from an Asp.Net MVC 5 one.

  3. Log in to comment