TypeScript: Build fails with `"PreferredUILang" parameter is not supported by the "VsTsc"`

After installing TS 2.2 for VS 2015, build fails in VS 2017 with error:

MSB4064	The "PreferredUILang" parameter is not supported by the "VsTsc" task. Verify the parameter exists on the task, and it is a settable public instance property.

More details can be found at https://vsfeedback/comment/826493

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 37 (13 by maintainers)

Most upvoted comments

When adding a nuget package, you will need to manually remove the imports to the machine-wide targets and props. having both leads to unknown load order or targets/tasks, which would manifest in such errors.

In Nuget v2 we used to have support for install.ps1 scripts that removes the machine-wide target/prop imports when the package is installed, but that has been deprecated in Nuget v3 (see more at https://github.com/NuGet/Home/issues/1020).

also related issue is https://github.com/Microsoft/TypeScript/issues/12527

Hello guys, just FYI, I landed here because I hit the same error message after installing Microsoft.TypeScript.Compiler 2.2.1 and Microsoft.TypeScript.MSBuild 2.2.2 in an existing project using TS under VS 2015.

I managed to eliminate it using by removing the leftovers from the previously used TS version, precisely, by manually removing <Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\TypeScript\Microsoft.TypeScript.targets" Condition="Exists('$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\TypeScript\Microsoft.TypeScript.targets')" /> somewhere near end of the .csproj file.

So, the first entry <Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\TypeScript\Microsoft.TypeScript.Default.props" Condition="Exists('$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\TypeScript\Microsoft.TypeScript.Default.props')" /> was replaced by Nuget during package installation to match the new path, but the second was left as-is and, I think, was causing the issue.