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
How was this issue fixed? I experience it with TS 2.2.2 building on VSTS (Hosted)
@zhengbli can you look into the vsts issue?
I get packages\Microsoft.TypeScript.MSBuild.2.2.2\tools\microsoft.TypeScript.targets(204,7): 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. while building the solution.
The targets file is still setting PreferredUILang:
<Target Name="PreComputeCompileTypeScriptWithTSConfig"
Condition="'@(ConfigFiles)' != ''">
<VsTsc
ToolPath="$(TscToolPath)"
ToolExe="$(TscToolExe)"
PreferredUILang="$(PreferredUILang)"
TSConfigFile="%(ConfigFiles.Identity)"
YieldDuringToolExecution="$(TscYieldDuringToolExecution)"
ProjectDir="$(TypeScriptProjectDir)"
ToolsVersion="$(TypeScriptToolsVersion)"
TypeScriptCompileBlocked="$(TypeScriptCompileBlocked)"
ComputeOutputOnly="true">
<Output TaskParameter="GeneratedJavascript" ItemName="emittedFiles" />
</VsTsc>
<ItemGroup>
<GeneratedJavascript Include="@(emittedFiles)" KeepDuplicates="false" />
</ItemGroup>
</Target>
I can confirm that removing all instances of PreferredUILang="$(PreferredUILang)" from the Microsoft.TypeScript.MSBuild.2.2.2\tools\microsoft.TypeScript.targets solves the problem.
Since there are no code changes related to this issue I can only assume it was closed without actual fix (Issue was closed at the same time as the developer was assigned to investigate it).
Workaround: Remove all instances of PreferredUILang="$(PreferredUILang)" from the packages\Microsoft.TypeScript.MSBuild.2.2.2\tools\microsoft.TypeScript.targets file and include the package folder into source control.
Can you share the version of the tasks dll?
The version of _TypeScript.Tasks.dll_ included in _Microsoft.TypeScript.MSBuild.2.2.2.nupkg_ is 14.40321.1.0
@jkonecki can you try set the build output verbosity level to diagnostics by going to tools -> options -> Project and Solutions -> Build and run, and set

And then look for the path of "tsc.exe" in the build output? I would like to see if the correct one was used.
I cannot provide the path to tsc.exe as the problem is with calling VsTsc task in the first place.
Here is the detailed output from the build:
2017-03-28T08:20:21.7060412Z ##[debug]Processed: ##vso[task.logdetail id=e5a2f899-a750-4145-b31c-19d9ed8faf18;parentid=;name=packages\Microsoft.TypeScript.MSBuild.2.2.2\tools\microsoft.TypeScript.targets;type=Build;starttime=2017-03-28T08:20:21.6940406Z;state=InProgress;]
2017-03-28T08:20:21.7130417Z ##[error]packages\Microsoft.TypeScript.MSBuild.2.2.2\tools\microsoft.TypeScript.targets(203,7): 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.
2017-03-28T08:20:21.7130417Z ##[debug]Processed: ##vso[task.logissue type=Error;sourcepath=C:\a\1\s\packages\Microsoft.TypeScript.MSBuild.2.2.2\tools\microsoft.TypeScript.targets;linenumber=203;columnnumber=7;code=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.
2017-03-28T08:20:21.7130417Z ##[debug]Processed: ##vso[task.logdetail id=e5a2f899-a750-4145-b31c-19d9ed8faf18;parentid=;type=Build;result=Failed;finishtime=2017-03-28T08:20:21.6990408Z;progress=100;state=Completed;parentid=;name=;]
2017-03-28T08:20:21.7130417Z C:\a\1\s\packages\Microsoft.TypeScript.MSBuild.2.2.2\tools\microsoft.TypeScript.targets(203,7): 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. [C:\a\1\s\Portfolio\Portfolio.csproj]
2017-03-28T08:20:21.7130417Z ##[error]packages\Microsoft.TypeScript.MSBuild.2.2.2\tools\microsoft.TypeScript.targets(199,5): Error MSB4063: The "VsTsc" task could not be initialized with its input parameters.
2017-03-28T08:20:21.7140418Z ##[debug]Processed: ##vso[task.logissue type=Error;sourcepath=C:\a\1\s\packages\Microsoft.TypeScript.MSBuild.2.2.2\tools\microsoft.TypeScript.targets;linenumber=199;columnnumber=5;code=MSB4063;]The "VsTsc" task could not be initialized with its input parameters.
2017-03-28T08:20:21.7140418Z C:\a\1\s\packages\Microsoft.TypeScript.MSBuild.2.2.2\tools\microsoft.TypeScript.targets(199,5): error MSB4063: The "VsTsc" task could not be initialized with its input parameters. [C:\a\1\s\Portfolio\Portfolio.csproj]
You need to either remove setting of PreferredUILang input parameter in the targets file (assuming task is correct) or add support for PreferredUILang input parameter to the task (assuming targets file is correct). I suppose the former change should be made.
You might also want to remove the Fixed label from this issue.
Thanks for replying. Actually can you send the entire log? My email is [email protected]. Because we need to see if the tasks and the targets have a mismatch, which is likely what has caused the problem. The solution is to align the tasks that support PreferredUILang with the targets not containing it, though there are many floating parts and looking at the log could help much.
I've emailed detailed logs as requested.
Because we need to see if the tasks and the targets have a mismatch, which is likely what has caused the problem.
Both task and targets files come from your own NuGet package. You can start by checking them.
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.
Thank you @pablonautic for your suggestion.
My problem seems to be a bit different as my project doesn't have Microsoft.TypeScript.targets import at all.
I have same problem here in VS2015 14.0.25431.01 Update 3, (VS2017 also installed)
File->New Project->select Typescript/HTML Application with Typescript template.
Compile->OK
install nuget
<package id="Microsoft.TypeScript.MSBuild" version="2.2.2" targetFramework="net452"
developmentDependency="true" />
Compile->FAIL
------ Build started: Project: TypeScriptHTMLApp3, Configuration: Debug Any CPU ------
c:\users\xxx\documents\visual studio 2015\Projects\TypeScriptHTMLApp3\packagesMicrosoft.TypeScript.MSBuild.2.2.2\tools\microsoft.TypeScript.targets(204,7): 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.
c:\users\xxx\documents\visual studio 2015\Projects\TypeScriptHTMLApp3\packagesMicrosoft.TypeScript.MSBuild.2.2.2\tools\microsoft.TypeScript.targets(200,5): error MSB4063: The "VsTsc" task could not be initialized with its input parameters.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
When I deleted all PreferredUILang="$(PreferredUILang)" from .target, it seemed to work.
But my scenario for adding this nuget package was to make it possible to use exact version of TSC, not to tweak it. I need to make it run on hosted team services build also.
My guess is that for VS2015 there is no PreferredUILang prop, but only for VS2017, and there should be two .targets files in nuget package sources.
Downgrading nuget package to version 2.2.1 seems to work. I tried it also in hosted team services build (with option Visual Studio 2017) and it worked
@spustlik can you try installing the latest TS 2.2 for VS 2015 at http://www.typescriptlang.org/#download-links to see if that solves it
The HTML Application with TypeScript template was using the v1.8 tsc.exe thus caused the issue. Investigating why that happens but you can try that as a workaround
I've already installed this (see image below), this doesn't solve the issue.
My story is that some actual typings from npm was not compatible with older TS (i thing I was on 2.0 before). So I updated VS2015 to use TS 2.2. It worked ok, but my hosted builds on visualstudio.com started to fail, because hosted build environment is using only 1.0-2.0 versions of TS (see log below).
So I started to look for solution to take version of Typescript compiler side-by-side with my VS solution. Nuget package seems to be good solution. As I mentioned above, version 2.2.1 of nuget package is working OK.
2017-03-31T09:33:40.6192505Z ##[section]Starting: Run dir
2017-03-31T09:33:40.6292504Z ==============================================================================
2017-03-31T09:33:40.6292504Z Task : Command Line
2017-03-31T09:33:40.6292504Z Description : Run a command line with arguments
2017-03-31T09:33:40.6292504Z Version : 1.1.2
2017-03-31T09:33:40.6292504Z Author : Microsoft Corporation
2017-03-31T09:33:40.6292504Z Help : More Information
2017-03-31T09:33:40.6292504Z ==============================================================================
2017-03-31T09:33:40.6571067Z ##[command]dir "C:\Program Files (x86)\Microsoft SDKs\TypeScript\"
2017-03-31T09:33:40.6691049Z Volume in drive C has no label.
2017-03-31T09:33:40.6691049Z Volume Serial Number is 78C2-210A
2017-03-31T09:33:40.6691049Z
2017-03-31T09:33:40.6691049Z Directory of C:\Program Files (x86)\Microsoft SDKs\TypeScript
2017-03-31T09:33:40.6691049Z
2017-03-31T09:33:40.6691049Z 12/14/2016 08:02 PM

If I am trying to find all TypeScript.Tasks.dll, I found it at:
packages\Microsoft.TypeScript.MSBuild.2.2.2
packages\Microsoft.TypeScript.MSBuild.2.2.1
"C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v12.0\TypeScript"\ - 14.31015.1.0
"C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\TypeScript"\ - 14.40221.2.0
"C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v15.0\TypeScript"\ - 14.40221.2.0
So it seems that older version of TypeScript.Tasks.dll from v14.0 folder is executed instead of that 14.40321.1.0 from 2.2.2 nuget package...
We actually released a new version (TypeScript 2.2.2) for VS 2015, namely the link. If you can give that a try.
I agree the nuget package should use what comes with the nuget, though it is tied to how the project template was authored (the order of imports etc.) Just to confirm, what are the project templates that have this issue for you? Any others beside the HTML Application one?
Great, this works locally. I overlooked difference beween 2.2.1 and 2.2.2, my apologies.
But when trying to execute hosted build, it fails.
2017-03-31T20:19:19.2361325Z (PreComputeCompileTypeScriptWithTSConfig target) ->
2017-03-31T20:19:19.2361325Z C:\a\1\s\packagesMicrosoft.TypeScript.MSBuild.2.2.2\tools\microsoft.TypeScript.targets(183,7): 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. [C:\a\1\s\SkillDriver.Web\SkillDriver.Web.csproj]
2017-03-31T20:19:19.2361325Z C:\a\1\s\packagesMicrosoft.TypeScript.MSBuild.2.2.2\tools\microsoft.TypeScript.targets(180,5): error MSB4063: The "VsTsc" task could not be initialized with its input parameters. [C:\a\1\s\SkillDriver.Web\SkillDriver.Web.csproj]
2017-03-31T20:19:19.2371376Z
@spustlik so now you're in the same place as me. Try my workaround posted above that involves editing targets file and committing NuGet package folder.
We're having this same issue.
Building from MSBuild command line (coming with VS2015 Update 3), plus TS2.2.2 nuget package (the newer TypeScript VSIX addin is NOT installed).
I understand VSIX is adding value to IDE experience, but nuget should be enough for MSBuild?
Removing these from my CSPROJ solved the problem for us:
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\TypeScript\Microsoft.TypeScript.Default.props" Condition="Exists('$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\TypeScript\Microsoft.TypeScript.Default.props')" />
...
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\TypeScript\Microsoft.TypeScript.targets" Condition="Exists('$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\TypeScript\Microsoft.TypeScript.targets')" />
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\WebApplications\Microsoft.WebApplication.targets" Condition="Exists('$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\WebApplications\Microsoft.WebApplication.targets')" />
I am reluctant to edit anything in packages directory, as these edits are hard to reflect across the team consistently.
The reason is that we have a breaking change between 2.1+ and 1.8 TypeScirpt tasks file, and the nuget package was not enforcing using the tasks file matching its target file. A PR was sent on the managed side to solve this issue.
Thank you for the update.
Could you please provide the link to the PR?
Will a new NuGet package be provided once the issue is fixed?
On Thu, 6 Apr 2017 5:04 am Zhengbo Li, notifications@github.com wrote:
The reason is that we have a breaking change between 2.1+ and 1.8
TypeScirpt tasks file, and the nuget package was not enforcing using the
matching tasks file. A PR was sent on the managed side to solve this issue.—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/Microsoft/TypeScript/issues/14801#issuecomment-292063222,
or mute the thread
https://github.com/notifications/unsubscribe-auth/ABsWj3y15e99whI5e_-fslGtYxd7RKbZks5rtGRVgaJpZM4Mln7B
.
@jkonecki sorry the nuget & visual studio part is not open-sourced yet, which was why you saw this issue got closed with no changes made to this repo. I'll keep you updated. Yes a new version of the package should be published once this is fixed.
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
@mhegazy I manually commented out
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\TypeScript\Microsoft.TypeScript.Default.props" Condition="Exists('$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\TypeScript\Microsoft.TypeScript.Default.props')" />
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\TypeScript\Microsoft.TypeScript.targets" Condition="Exists('$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\TypeScript\Microsoft.TypeScript.targets')" />
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\WebApplications\Microsoft.WebApplication.targets" Condition="Exists('$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\WebApplications\Microsoft.WebApplication.targets')" />
Though this doesn't solve the issue. The Hosted Visual Studio Team Services gives the following error:
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.
Now, this points me to what @jkonecki suggested earlier, manually removing references to PreferredUILang. So apart for commenting out the above code from .csproj we also need to remove references to PreferredUILang ?
I think so. Give it a go.
On Thu, 18 May 2017 19:32 Shyamal Parikh, notifications@github.com wrote:
@mhegazy https://github.com/mhegazy I manually commented out
Though this doesn't solve the issue. The Hosted Visual Studio Team
Services gives the following error: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.Now, this points me to what @jkonecki https://github.com/jkonecki
suggested earlier, manually removing references to PreferredUILang. So
apart for commenting out the above code from .csproj we also need to
remove references to PreferredUILang ?—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/Microsoft/TypeScript/issues/14801#issuecomment-302503161,
or mute the thread
https://github.com/notifications/unsubscribe-auth/ABsWj2jxVrtRmbLQqlYvMil2xJx8zVl_ks5r7I6mgaJpZM4Mln7B
.
Frankly, this is too much of a hack. Not only do the user have to manually remove PreferredUILang references, he would also have to include the package folder to source control. Again if the VSTS hosted build is set to reinstall nuget packages on build, there is no guarantee that the modified file wouldn't be over-written @mhegazy hope a solution to this is found soon.
Even better if VSTS hosted build supports 2.2.2 as it would remove the need for any kind of changes.
You don't need to include package folder into the source control. Just
removing PreferedUILang and invalid imports should be enough.
On Thu, 18 May 2017 20:30 Shyamal Parikh, notifications@github.com wrote:
Frankly, this is too much of a hack. Not only do the user have to manually
remove PreferredUILang references, he would also have to include the
package folder to source control. Again if the VSTS hosted build is set to
reinstall nuget packages on build, there is no guarantee that the modified
file wouldn't be over-written @mhegazy https://github.com/mhegazy hope
a solution to this is found soon.Even better if VSTS hosted build supports 2.2.2 as it would remove the
need for any kind of changes.—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/Microsoft/TypeScript/issues/14801#issuecomment-302517363,
or mute the thread
https://github.com/notifications/unsubscribe-auth/ABsWjzX3MXOvr8tDfZ2C0EmOfApyiaGPks5r7JxEgaJpZM4Mln7B
.
But the project is built with VSTS hosted build so I would have to include the modified target file to source control
What version of TS are you using to build?
@mhegazy 2.2.2.
I'm having the exact same problem. I am attempting to upgrade a TS 1.8.x app to 2.2.x _(since 2.3.x currently has this issue that I'm attempting to avoid by waiting to upgrade)_.
So far I've installed the Microsoft.TypeScript.Compiler package at 2.2.1 and the
Microsoft.TypeScript.MSBuild package at 2.2.2, and added a tsconfig.json file. It builds locally fine, but when I trigger a build on our TFS server I get the following errors
Source\packages\Microsoft.TypeScript.MSBuild.2.2.2\tools\microsoft.TypeScript.targets (183, 7)
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.
Source\packages\Microsoft.TypeScript.MSBuild.2.2.2\tools\microsoft.TypeScript.targets (180, 5)
The "VsTsc" task could not be initialized with its input parameters.
I tried following the advice here and I removed the following imports from my csproj file
<Import Project="$(VSToolsPath)\WebApplications\Microsoft.WebApplication.targets" Condition="'$(VSToolsPath)' != ''" />
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\TypeScript\Microsoft.TypeScript.targets" Condition="Exists('$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\TypeScript\Microsoft.TypeScript.targets')" />
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\TypeScript\Microsoft.TypeScript.Default.props" Condition="Exists('$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)\TypeScript\Microsoft.TypeScript.Default.props')" />
I still get the same error. We have other applications that are on TS 2,2.x and I can't figure out what is different about those apps vs, this one. Those work without error, but this one does not.
ok, this is what worked for me, I took it from: http://stackoverflow.com/a/43933100/79677
We are using VS2015 everywhere and have TFS set to build with that version, so I set the version to be 14.0 everywhere. This seemed to be the last key!
can you share your project file and or your build log?
@mhegazy me? No I can't, sorry. I know that my above message totally fixed the issue. It appears to still be breaking until I changed the version numbers like in my screenshot.
Most helpful comment
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.ps1scripts 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