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
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:
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!
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>
To ensure you get the correct settings in your Visual Studio project file:
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)
Your project file should have updated. Save it.
Close the solution and re-open it.
TypeScript Build Tab should be in the project properties.
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
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.
I have added "TypeScriptToolsVersion" in csproj.
<Project>
<PropertyGroup>
...
<TypeScriptToolsVersion>1.0</TypeScriptToolsVersion>
</PropertyGroup>
</Project>
But it is Visual Studio 2013 RC2.