2

I'm using Visual Studio 2013 to create an MVC5 application. I decided to use TypeScript for the client side. I have TypeScript installed and more or less configured. When I build the project JavaScript files appear next the TypeScript files (*.js and *js.map).

The problem is that those files are not included in the solution. I can only see them when I select "Show All Files" in Solution Explorer or browse my solution folder with file explorer.

I see 2 bad consequences:

  1. When I add a .js file to a view like that <script src="~/Scripts/Custom/Tmp.js"></script> Resharper complains "Project file expected at XYZ". However when I run the MVC application JavaScripts work fine.
  2. If the .js files are not included in the solution they won't be published and so the webpage won't work properly.

The only solution that comes to my mind is to add the files manually, but:

  • this sounds very tedious
  • I think the .js files are not being added for some purpose

What's the proper way to use TypeScript in an MVC application?

1
  • Though Typescript compilation should work just fine in VS,you can also use BundleTransformer (bundletransformer.codeplex.com) to have the TypeScript compiled, minimized etc at runtime Commented Jan 24, 2014 at 22:02

1 Answer 1

2

My experience so far with a project just like yours is unproblematic. After working with TypeScript so much, it's become painful to look at JavaScript!

Problem 1) doesn't happen in plain VS suggesting that the issue is with ReSharper.

Problem 2) isn't. Deployment works somehow; the .js files are published but the .js.map files are not.

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.