Visual Studio TypeScript Options

左心房为你撑大大i 提交于 2019-12-29 04:40:09

问题


How do I tell the TypeScript compiler to generate amd modules (--module amd) from within Visual Studio.

Thanks.


回答1:


In your project file you will need to change the MSBuild target that is building TypeScript files. If you are using the default template for "HTML Application built with TypeScript", unload your project, edit the project file, you will find a target called "BeforeBuild" that is calling the compiler at "$(PROGRAMFILES)\Microsoft SDKs\TypeScript\0.8.0.0\tsc", add --module amd to it; save and reload your project. next time you build you should see the command argument passed correctly to the compiler.




回答2:


On the latest Visual Studio 2013 Update 3 + WebEssentials the options are now (finally) properly moved in the Project Options Pane (Right click on the project -> Options -> TypeScript Build pane).




回答3:


Becouse this problem is still actual even for TS 1.0 and WebEssentials for VS 2013 Update 3, check this solution here: http://icanmakethiswork.blogspot.com/2014/02/typescript-and-requirejs-keep-it-simple.html Or shortly:

1) Open project file.

2) find this lines:

  <Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\TypeScript\Microsoft.TypeScript.targets" Condition="Exists('$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\TypeScript\Microsoft.TypeScript.targets')" />

3)Insert this lines before:

    <PropertyGroup Condition="'$(Configuration)' == 'Debug'">
    <TypeScriptModuleKind>amd</TypeScriptModuleKind>
  </PropertyGroup>
  <PropertyGroup Condition="'$(Configuration)' == 'Release'">
    <TypeScriptModuleKind>amd</TypeScriptModuleKind>
  </PropertyGroup>


来源:https://stackoverflow.com/questions/12710691/visual-studio-typescript-options

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!