Why is the Typescript settings tab missing in my VS 2013 ASP.NET project properties?

后端 未结 7 1528
[愿得一人]
[愿得一人] 2021-01-01 23:54

I\'m trying to migrate some javascript files to Typescript in a legacy ASP.NET MVC 5 project. I I\'ve created a Typescript file and the compilation from TS to JS works as ex

相关标签:
7条回答
  • 2021-01-02 00:15

    If your csproj has

    Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersi>on)\TypeScript\Microsoft.TypeScript.targets" >Condition="Exists('$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualS>tudioVersion)\TypeScript\Microsoft.TypeScript.targets')" />

    and still you have issue.

    Do the below things:

    1. Add a new typescript file in the project.
    2. Build the solution.
    3. Close and start the Visual Studio, Open the project.
    4. Check the Typescript Tab in the project properties.
    0 讨论(0)
  • 2021-01-02 00:23

    I'm not sure about 2013, but for VS2015, you just need to add a TypeScript file to the root folder of the project and it will popup a dialog asking you if you want to configure the project for TypeScript. Simple!

    0 讨论(0)
  • 2021-01-02 00:29

    Another possible cause of this is having an old Visual Studio version number in the VisualStudioVersion node in the .csproj file:

    For VS 2013 it should be:

    <VisualStudioVersion>12.0</VisualStudioVersion>
    

    For VS 2015 it should be:

    <VisualStudioVersion>14.0</VisualStudioVersion>
    

    For VS 2017 it should be:

    <VisualStudioVersion>15.0</VisualStudioVersion>
    
    0 讨论(0)
  • 2021-01-02 00:29

    To ensure you get the correct settings in your Visual Studio project file:

    1. Add a temp.ts file to your project via Visual Studio and save it (you may get a dialogue about Visual Studio looking up TypeScript types)

    2. Your project file should have updated. Save it.

    3. Close the solution and re-open it.

    4. TypeScript Build Tab should be in the project properties.

    5. Delete the temp.ts file.

    (I derived this from Eric D. Johnson's comment here):

    https://developercommunity.visualstudio.com/content/problem/98916/typescript-build-tab-not-showing-in-project-proper.html

    0 讨论(0)
  • 2021-01-02 00:32

    I needed to add the following line to the csproj to import the typescript targets:

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

    Then I could see the typescript build options in the project settings.

    0 讨论(0)
  • 2021-01-02 00:32

    I have added "TypeScriptToolsVersion" in csproj.

      <Project>
        <PropertyGroup>
          ...
          <TypeScriptToolsVersion>1.0</TypeScriptToolsVersion>
        </PropertyGroup>
      </Project>
    

    But it is Visual Studio 2013 RC2.

    0 讨论(0)
提交回复
热议问题