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

余生长醉 提交于 2019-12-18 14:53:22

问题


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 expected, but I there is no "Typescript Build" Tab in my legacy project's properties.

I did not have this problem when working on a new ASP.NET MVC 5 project. How can I fix this in my legacy project? I am using Visual Studio 2013 Update 1.

Thanks,

Adrian


回答1:


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.




回答2:


As Hans Passant correctly hinted in the comments, the problem was the following ProjectGuid in my .csproj file: {349c5851-65df-11da-9384-00065b846f21}

Once I removed that GUID from my project file and reloaded my project, the Typescript tab showed up in the project properties.




回答3:


I have added "TypeScriptToolsVersion" in csproj.

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

But it is Visual Studio 2013 RC2.




回答4:


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>



回答5:


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!




回答6:


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




回答7:


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.


来源:https://stackoverflow.com/questions/23130665/why-is-the-typescript-settings-tab-missing-in-my-vs-2013-asp-net-project-propert

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