TypeScript: The "VsTsc" task could not be initialized with its input parameters. (after upgrade to VS 2017.15.6.1)
Search Terms: VsTsc, Build , 2017
Expected behavior: Be able to build my AspNetCore 2 web application without errors
Actual behavior: 2 errors displayed after build attempt:
- Error MSB4063 The “VsTsc” task could not be initialized with its input parameters. Jbssa.Feedlot.Web C:\Program Files (x86)\Microsoft SDKs\TypeScript\2.5\build\Microsoft.TypeScript.targets 196
- Error MSB4064 The “ComputeOutputOnly” parameter is not supported by the “VsTsc” task. Verify the parameter exists on the task, and it is a settable public instance property. Jbssa.Feedlot.Web C:\Program Files (x86)\Microsoft SDKs\TypeScript\2.5\build\Microsoft.TypeScript.targets 207
I was asked to include the following tsconfig.json file in my project in a previous issue.
{
"compilerOptions": {
"allowJs": true,
"noEmit": true,
"declaration": false
},
"include": [
"wwwroot/js"
],
"exclude": [
"lib"
]
}
And this is my csproj file for the failing web project.
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>netcoreapp2.0</TargetFramework>
<ApplicationIcon>wwwroot\favicon.ico</ApplicationIcon>
<AssemblyName>Jbssa.Feedlot.Web</AssemblyName>
<RootNamespace>Jbssa.Feedlot.Web</RootNamespace>
<TypeScriptToolsVersion>2.5</TypeScriptToolsVersion>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="AutoMapper.Extensions.Microsoft.DependencyInjection" Version="3.2.0" />
<PackageReference Include="BuildBundlerMinifier" Version="2.6.362" />
<PackageReference Include="Core.ExceptionTranslation" Version="2.0.18052.1" />
<PackageReference Include="Core.Mvc" Version="2.0.18038.1" />
<PackageReference Include="FluentValidation.AspNetCore" Version="7.5.0" />
<PackageReference Include="Flurl.Http" Version="2.2.1" />
<PackageReference Include="Microsoft.AspNetCore.All" Version="2.0.5" />
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="2.0.2" />
<PackageReference Include="Serilog.Settings.Configuration" Version="2.5.0" />
<PackageReference Include="Serilog.Sinks.Async" Version="1.1.0" />
<PackageReference Include="Serilog.Sinks.File" Version="4.0.0" />
<PackageReference Include="Serilog.Sinks.Literate" Version="3.0.0" />
<PackageReference Include="Serilog.Sinks.Seq" Version="4.0.0" />
</ItemGroup>
<ItemGroup>
<DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="2.0.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Jbssa.Feedlot.Core\Jbssa.Feedlot.Core.csproj" />
<ProjectReference Include="..\Jbssa.Feedlot.BusinessLogic\Jbssa.Feedlot.BusinessLogic.csproj" />
<ProjectReference Include="..\Jbssa.Feedlot.Security\Jbssa.Feedlot.Security.csproj" />
</ItemGroup>
<ItemGroup>
<Folder Include="wwwroot\js\BunkCall\" />
</ItemGroup>
<ItemGroup>
<Content Update="wwwroot\js\BunkCall\DropsRationPercent.js">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
</Project>
Please note that deleting the tsconfig.json file from the project allowed it to build successfully, and the older issue complaining about too many files for intellisense is not present either. Therefore I assume that the underlying issues with VS2017 and compling ts files is fixed and doesn’t need the config file anymore. This would have been nice to read in the Release Notes.
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 11
- Comments: 57 (20 by maintainers)
Here’s my analysis of this problem:
When does this error come up?
Once scenario (which is hitting us hard) where this error comes up when the highest effective TypeScriptToolsVersion >= 2.6 and the lowest is <= 2.5 across all TypeScript enabled projects in the currently loaded solution. We have this because we are incrementally upgrading projects from 2.4 to 2.7 and can’t do this big bang primarily because noUsedLocals has become stricter and requires code changes to make it comply with the stricter model.
Why does this error come up?
In version 2.6, the ComputeOutputOnly property for the VsTsc task (the task that’s defined in Microsoft.TypeScript.Tasks.dll and is responsible for invoking the actual TypeScript compiler) was renamed to ComputeInputAndOutputOnly. Although Visual Studio has all the plumbing in place to try and load Microsoft.TypeScript.Tasks.dll from the right folder, if/once the 2.7 DLL gets loaded, attempts to load the 2.4 DLL result in that same DLL being used which doesn’t have the ComputeOutputOnly property. This is in turn because their TypeNames, including their AssemblyVersion, are same but their public signature (and code) is obviously different. It seems the actual DLL loaded (first) is based on the highest TypeScriptEffectiveToolsVersion rather than which project is compiled first which is why the error is always about the missing old property rather than the missing new property.
Workaround we’ve implemented
Closing remarks
This is a general .NET limitation that two assemblies with the same TypeName can’t be loaded in the same process (AppDomain+LoadContext to be more specific) so this is a fundamental flaw/shortcoming in the concurrent-multi-version support for TypeScript. The official fix would probably have to be at least assign these Tasks assemblies a different AssemblyVersion for each TypeScript release. Once again, our workaround downgrades only the VsTsc task but the actual compiler (tsc.exe) will still be picked based on the TypeScriptToolsVersion in the project allowing us to upgrade each project on its own schedule.
I’m also facing the same problem, please try to resolve it fast.
I have VS version 2017.15.6.2
For solutions, install or update lasted nugget package from current project:
TypeScript.MSBuildTask Microsoft.TypeScript.Compiler Microsoft.TypeScript.MSBuild
Just upgraded to 15.6.2 and got the same issue, updated the Microsoft.TypeScript.Compiler and Microsoft.TypeScript.MSBuild nuget packages and it resolved the issue!
Hello all, This seems to be a related issue to the one discussed at https://github.com/Microsoft/TypeScript/issues/18335#issuecomment-358391454
We are actively working on ways to address this issue in general, but for now, closing VS, ensuring that any and all MSBuild.exe processes are killed, and reopening VS should resolve the issue. Please let me know if it does not, and I would be happy to investigate further.
Thank you! Ben Lichtman TypeScript Language Service Engineer
This is not ‘fixed’ by any stretch of the imagination. VS2017 still has the same problems, all above solutions not withstanding.
Please stop closing this issue until you’ve actually fixed the issue.
Sorry for the lack of updates on the issue. It’s been fixed in TypeScript 2.8.
The 2.8 SDK is available in Visual Studio 15.7, which is currently in preview. For most people, upgrading to Visual Studio to 15.7, installing the TypeScript 2.8 SDK directly, or installing the TypeScript 2.8 Nuget package will solve the issue.
If you’re still seeing this bug, ensure at least one of the following is true for your solution:
<TypeScriptToolsVersion>
property set, and it’s the same version for all of them.<TypeScriptToolsVersion>2.3</TypeScriptToolsVersion>
and you just can’t change that, just make sure that all the other projects are either set to 2.3, or 2.8.If that still isn’t working, please let me know which errors you’re seeing and which version(s) of TypeScript you’re using in your projects. Thanks!
@RogerDawson, that actually did help a lot, thank you. Here’s what’s happening; the
TypeScript.Tasks.dll
that ships with VS 15.6 is a newer version than what ships with the NuGet package. For some reason, the in-box dll is being loaded first, so the dll from the NuGet package is not loaded. We have updated the NuGet package to 2.6.5 so that it matches the in-box dll, so the scenario in which you have upgraded your project to 2.6 should work.However, to focus on @spelltwister’s scenario, it is still possible to load the in-box dll and try to use the 2.3 targets file. We are working on changes that will fix this issue in general, but in the short term, if you are not able to upgrade to 2.6, you will need to ensure that no other part of your build is pulling in the in-box TypeScript dll. To do so, you should ensure you’re either including the TypeScript NuGet package on every project being built, or at least ensuring that all projects that don’t have TypeScript don’t mention TypeScript in their .csproj files (and ensuring all that do are using the NuGet package).
Please let me know if this helps, and thank you for your help in figuring this out!
I’m not sure what you need from me exactly. my logs are the same as above. if you need something more, i can try to provide it, but have you tried running a project targeting, for example, the 2.3.3 typescript version and building it on the hosted vs2017 agent? all of my projects for different companies broke so i would imagine it easy to reproduce. and it’s been going on so long that we’ve had to scramble for different build / deploy options. One place we did the private build servers, another we’re building locally and pushing from studio on machines that still compile. what a mess 😦
I was able to fix this by going to my project properties, clicking ‘TypeScript Build’ and changing the TypeScript version to ‘Use latest available’.
This essentially changes the <TypeScriptToolsVersion> tag in the .csproj file to the value of ‘Latest’, which in my case is 2.6. Previously I was explicitly targeting 2.5.
Upgrading to Microsoft.TypeScript.MSBuild 2.8.3 fixed this issue for me. Using VS 2017 15.5.7.
Hi @uniqueiniquity , so I now only have the Microsoft.TypeScript.MsBuild package version 2.6.2 and I still get the error:
2018-03-22T16:05:14.8758935Z (PreComputeCompileTypeScriptWithTSConfig target) -> 2018-03-22T16:05:14.8759677Z C:\Users\VssAdministrator.nuget\packages\microsoft.typescript.msbuild\2.6.2\tools\Microsoft.TypeScript.targets(208,7): error MSB4064: The “ComputeOutputOnly” parameter is not supported by the “VsTsc” task. Verify the parameter exists on the task, and it is a settable public instance property. [D:\a\1\s\Dashboard\Dashboard.csproj] 2018-03-22T16:05:14.8760818Z C:\Users\VssAdministrator.nuget\packages\microsoft.typescript.msbuild\2.6.2\tools\Microsoft.TypeScript.targets(197,5): error MSB4063: The “VsTsc” task could not be initialized with its input parameters. [D:\a\1\s\Dashboard\Dashboard.csproj]
I did a bit of digging on the hosted build agent and it suggested that Typescript 2.0, 2.1 and 2.2 are installed on the Hosted 2017 agent which is strange, given we’ve been running with 2.3 for a year or so now. Here is the link: VSTS image definition on GitHub . This is muddying the waters even more though so I think I’m going to ignore what the readme says.
To top my day off I can’t publish from my local dev PC anymore due to a completely different publishing error (worked a few weeks ago so I can only assume the latest versions of VS 2017 have caused this 15.6.0-15.6.3 I guess). Frustrating to say the least.
Thanks for the help so far though
I know @uniqueiniquity, but it was suggested by @eaguerrerov. So I’m just saying that that is not a helpful suggestion…
We’re having the exact same issue when building/publishing locally in Visual Studio 2017 and we’re not even using typescript with no typescript config file in the project that I can find.