To accomodate this scenario there are a few things we must do:
– The above file types must be retrieved via the custom VirtualPathProvider.
– Because we need to mark the TypeScript files as embedded resources, and because file can only have one build action, we also need a good way to compile all typescript files.
The first two points are obviously the easy parts, just select all .ts and .js.map files in your class library project, and set the build action to Embedded Resource.
|To have the custom VirtualPathProvider pick up those file types, you will have to change the web.config file of your MVC host project. Something like the following line should already be present:
<add verb="GET" path="*.js" name="Static for js" type="System.Web.StaticFileHandler" />
Add the following two lines just below that:
<add verb="GET" path="*.ts" name="Static for ts" type="System.Web.StaticFileHandler" /> <add verb="GET" path="*.js.map" name="Static for js.map" type="System.Web.StaticFileHandler" />
/// <reference path="My1stFile.ts" /> /// <reference path="My2ndFile.ts" />
Keep this file set to the regular build action. And on build, this file, and all files it references will get built.