Disclaimer: I'm new to just about every piece of technology I am using here, so forgive me please if I am missing the obvious...
I am starting to mess with MVC 4 with Entity Framework 5 and Web API, and I want to use TypeScript with Knockout to do some UI stuff. I found the TypeLite project which will take my EF model and generate TypeScript interfaces for me so that everything is "strongly" typed.
My solution consists of 3 projects:
- MyApp.dll = Contains all of the MVC work
- MyApp.Domain.dll = Contains the EF domain model
- MyApp.WebAPI.dll = Contains the WebAPI work
I added the TypeLite reference to the MyApp project (via NuGet), and modified the TypeLite.tt to read:
<#@ template debug="false" hostspecific="True" language="C#" #>
<#@ assembly name="$(SolutionDir)packages\TypeLite.0.8.2\lib\net40\TypeLite.dll" #>
<#@ assembly name="$(TargetDir)$(TargetFileName)" #>
<#@ import namespace="TypeLite" #>
<#@output extension=".d.ts"#>
<#= TypeScript.Definitions()
.For<MyApp.Domain.Models.Country>()
.For<MyApp.Domain.Models.State>()
.For<MyApp.Domain.Models.Address>()
.For<MyApp.Domain.Models.Contact>() #>
When I "Run Custom Tool" on the TypeLite.tt I get the error:
Compiling transformation: The type or namespace name 'MyApp' could not be found (are you missing a using directive or an assembly reference?)
I have tried adding the line(s):
<#@ import namespace="MyApp" #>
<#@ import namespace="MyApp.Domain" #>
<#@ import namespace="MyApp.Domain.Models" #>
It still keeps giving me the same error though. I am certain I am missing something trivial, and I am still picking thru the thousands of articles that Dr. Google finds for me referencing a search for this, but I am hoping that someone on here can help me find the light