0

I have the following situation:

  • A large ASP.NET site that we want to converter to typescript
  • The typescript projects as part of the solution, but in different projects
  • The typescript has been set to one only js file per project.
  • I use visual studio 2012 and typescript 0.9.5

The question is: is it possible to debug directly the typescript ts files with this configuration? If it is not possible what I need to modify to do that. The project is big and it not a good solution to put the typescript part inside it, because the time of compilation of the web application is very long.

Thanks

freedeveloper
  • 3,670
  • 34
  • 39
  • possible duplicate of [Enable the javascript debugger in the Page Inspector](http://stackoverflow.com/questions/12197255/enable-the-javascript-debugger-in-the-page-inspector) – Praveen Feb 08 '14 at 21:35
  • No, the question is not about page inspector. the question is if it is possible debug the ts file. when the typescript project is in another project, different to the web page project. I enabled source maps, install the typescript project as a web project, copy the js and map file to the web project, but not work. Any idea? – freedeveloper Feb 09 '14 at 03:07

3 Answers3

0

Yes. You need to enable sourcemaps and then start visual studio debugging with Internet explorer as the browser.

basarat
  • 261,912
  • 58
  • 460
  • 511
  • Thanks, but source maps are enabled, visual studio 2012 don't stop in breakpoint and Chrome or give a 402 error or if I enter manually the address of ts file don't give error, but does not debug the file. – freedeveloper Feb 09 '14 at 02:58
0

OK finally I discovered a method to debug ts using the typescript in independent project (as a C# library). The solution was to put the address of the ts files in the map files. to do this, you need to put the following tag in this case in propery group DEBUG in the csproj file.

<TypeScriptSourceMap>true</TypeScriptSourceMap>
<TypeScriptSourceRoot>http://localhost:37938/</TypeScriptSourceRoot>

Where the address is the address of the library project. Then you can debug from visual studio 2012 using internet explorer, or en Chrome directly using the chrome debug. In chrome remember to be active the map option in configuration debugger. I am using typescript 0.9.5

That is all.

freedeveloper
  • 3,670
  • 34
  • 39
0

The accepted answer doesn't work if you're trying to combine shared code with various projects because the merged Source Map file doesn't point to multiple projects by default (so you won't be able to debug the shared code), and I don't think there's a way to do that yet. Please correct me if I'm wrong.

Please see this question/answer indicating what has worked great for both solid code maintenance and debugging in Visual Studio, Chrome, and Firefox, while still retaining the ability to combine shared code with the referencing projects' code (important, for example, if you need to target different ECMAScript versions): Visual Studio: How to debug TypeScript in a shared project using IIS Express and cross-project references (no linking or duplicating files)

Community
  • 1
  • 1
lightmotive
  • 520
  • 5
  • 17