Monday, February 3, 2014

TypeScript error in Visual Studio 2012: microsoft.typescript.default.props not found

On a recent project, some developers are using Visual Studio 2012 and some are using Visual Studio 2013. We had no problems mixing Visual Studio versions until we started using TypeScript.

After adding a TypeScript file in Visual Studio 2013, the project starts throwing errors when we open it in Visual Studio 2012:

Microsoft.TypeScript.Default.props not found

It seems there are backwards compatibility issues when using a TypeScript project. It adds an import, microsoft.typscript.default.props. which doesn't exist in VS 2012.

To fix the problem, unload the project and edit the csproj file. Find the line that imports the Microsoft.TypeScript.Default.props and add an extra condition:

<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\TypeScript\Microsoft.TypeScript.Default.props"
Condition="Exists('$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion

No comments: