2

I'm trying to use TypeScript in my MVC4 application.

I add a TypeScript file to the Scripts folder y my app but Visual Studio 2012 doesn't generate the .js and .map files. It seems that ignore this file.

Using previous versions of WebEssentials and TypeScript my TypeScript files were compiled when I saved the .ts file, and .js and .map files where automatically generated.

Now with the latest version of WebEssentials and TypeScript I can't do the same.

What's new? What do I have to do to make it work?

1

2 Answers 2

6

I have found the solution comparing a TypeScript project file with a MVC project file.

In my MVC project file I have added this:

<TypeScriptTarget>ES5</TypeScriptTarget>
<TypeScriptIncludeComments>true</TypeScriptIncludeComments>
<TypeScriptSourceMap>true</TypeScriptSourceMap>
<TypeScriptModuleKind>AMD</TypeScriptModuleKind>

to the "Debug" and "Release" property groups, but it didn't work but I have seen this line at the end of my TypeScript project:

<Import Project="$(VSToolsPath)\TypeScript\Microsoft.TypeScript.targets" />

I have append this line to my MVC project and "voila!" compile on save works fine now.

Thanks

Sign up to request clarification or add additional context in comments.

Comments

0

Webessentials dropped support for TypeScript starting in V3, since it would be taken up by the VS team. And as map features are not implemented, they will not work at the moment. Compile on save should work though

2 Comments

Thanks. Compile on save only works if I create a TypeScriptHtml Project, but don't work in a MVC4 project ... What's happening?
There is a really good answer on the subject : stackoverflow.com/a/16660417/390330

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.