不能编译在Visual Studio 2012打字稿文件 [英] Cannot compile TypeScript files in Visual Studio 2012

查看:243
本文介绍了不能编译在Visual Studio 2012打字稿文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我下载并安装打字稿扩展VS 2012,我得到了我的第一个样本的编译通过手动拖动.ts文件的到tsc.exe文件!,因为没有其他的方式来编译文件将工作。

I downloaded and installed TypeScript extension for VS 2012, I got my first sample compiles by manually dragging the ts file onto the tsc.exe file! because no other way to compile the file will work.

我不想这样做手工每次这样我想调试一个页面!我已阅读网页和没有解决方案工作,对约5篇。我已经尝试添加打字稿编译器在Windows PATH中,我尝试下载并通过的NuGet包管理器Sholo安装的东西,我已经试过这些页面:

I don't want to manually do this everytime I want to debug a page! I have read about 5 articles on the web and none of the solutions work. I've tried adding TypeScript compiler to PATH in Windows, I've tried downloading and installing via Nuget Package Manager the Sholo thing, I've tried these pages:


  1. 使用CSHTML文件打字稿

  2. Visual Studio的打字稿选项

  3. < A HREF =htt​​p://stackoverflow.com/questions/12711826/debugging-typescript-code-with-visual-studio>使用Visual Studio调试打字稿代码

  4. $ b $ href=\"http://stackoverflow.com/questions/12758228/cannot-compile-typescript-using-tsc-node-module\">不能编译打字稿b
  5. 打字稿 - Visual Studio中 - D3

  6. 的Visual Studio 2012打字稿项目在编译<忽略两个文件/ A>

  7. 打字稿/的Visual Studio 2012 /编译参数

  8. 在现有的Visual Studio网站项目中使用打字稿

  9. Visual Studio的打字稿选项

  10. 编译生成在Visual Studio中的文件

  1. Using TypeScript in cshtml files
  2. Visual Studio TypeScript Options
  3. Debugging TypeScript code with Visual Studio
  4. Cannot compile typescript using tsc node module
  5. TypeScript - Visual Studio - d3
  6. Visual Studio 2012 TypeScript project ignoring two files during compile
  7. TypeScript / Visual Studio 2012 / Compilation parameters
  8. Using TypeScript in an existing Visual Studio Web Site project
  9. Visual Studio TypeScript Options
  10. Compile generated files in Visual Studio

而不是一个单一的解决方案已经奏效。

And not a single solution has worked.

我甚至下载并安装了Visual Studio中的Web必备插件,去了选项菜单,然后选择编译上构建= true的打字稿文件和编译打字稿上保存= TRUE - 但没有任何工程

I have even downloaded and installed the Web Essentials plugin for Visual Studio and gone to Options menu, then selected "Compile all TypeScript files on Build = True" and "Compile TypeScript on Save = True" - but nothing works.

我读过了整个打字稿网站,规范,并在CodePlex上的网站,即使他们的讨论标签

I've read the entire TypeScript website, the specification, and even their discussion tab on the codeplex site.

我怎样才能得到打字稿编译时,我将更改保存到 .TS 文件当我按F5 /调试/建造?

How can I get TypeScript to compile when I save changes to the .ts file or when I press F5/Debug/Build?

*我真的不希望任何第三方脚本/插件等,除非它是绝对必要的。我已经看到了他们夫妇,它只是...有没有意义。我还不如只写纯JavaScript。

*I don't really want any third-party scripts/plugins, etc unless it's absolutely necessary. I've seen a couple of them and it's just ... there's no point. I might as well just write pure JavaScript.

推荐答案

您必须确保BuildAction的必须是TypeScriptCompile你.TS文件。
我已经添加了这些行结束(.csproj的)项目文件。 (前收盘项目标签)
,它似乎工作。

You have to ensure that the BuildAction must be TypeScriptCompile for your .ts files. I've added these lines to end of the (.csproj) project file. (Before closing Project tag) And It seems working.

 <PropertyGroup Condition="'$(Configuration)' == 'Debug'">
<TypeScriptTarget>ES3</TypeScriptTarget>
<TypeScriptIncludeComments>true</TypeScriptIncludeComments>
<TypeScriptSourceMap>true</TypeScriptSourceMap>
<TypeScriptModuleKind>AMD</TypeScriptModuleKind>
 </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)' == 'Release'">
<TypeScriptTarget>ES3</TypeScriptTarget>
<TypeScriptIncludeComments>false</TypeScriptIncludeComments>
<TypeScriptSourceMap>false</TypeScriptSourceMap>
<TypeScriptModuleKind>AMD</TypeScriptModuleKind>
</PropertyGroup>
 <Import Project="$(VSToolsPath)\TypeScript\Microsoft.TypeScript.targets" />

这篇关于不能编译在Visual Studio 2012打字稿文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆