Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Debugging TypeScript files outside wwwroot

How should I debug TypeScript files in ASP.NET 5? Suppose solution layout as on the following picture. Notice .ts Scripts are outside wwwroot folder and compiled .js file is getting there via Grunt task. The task also creates .map file which references the original .ts files.

Note however that reference goes outside wwwroot (../Scripts/app.ts). This obviously doesn't work in a browser.

Any idea?

enter image description here

like image 342
Mikeon Avatar asked Apr 10 '15 09:04

Mikeon


1 Answers

I still have exact the same problem in Visual Studio 2015 Update 1. I solved it by using the following code snippet in Startup.cs:

public void Configure(IApplicationBuilder app, IHostingEnvironment env, IApplicationEnvironment appEnv)
{
    app.UseStaticFiles();
    if (env.IsDevelopment())
    { 
        app.UseFileServer(new FileServerOptions()
        {
            FileProvider = new PhysicalFileProvider(System.IO.Path.Combine(appEnv.ApplicationBasePath, "App")),
            RequestPath = new PathString("/App"),
        });
    }
}

All my TypeScript-Files are under /App

like image 60
stef Avatar answered Oct 05 '22 13:10

stef