TypeScript Version:
Microsoft.TypeScript.MSBuild NuGet package version 2.8.3
ts.exe version 2.8.3.
Search Terms:
error MSB6001: Invalid command line switch for "tsc.exe". Illegal characters in path.
Repro:
I have a .NET 4.6 VS SDK project that references Microsoft.TypeScript.MSBuild NuGet package version 2.8.3. The project has several <TypeScriptCompile> items. It also has a custom target to include .js files generated by ts into vsix:
<Target Name="AddTsToContent" AfterTargets="CompileTypeScript" Condition="'$(BuildingProject)' != 'false'">
<ItemGroup>
<Content Include="@(GeneratedJavascript)">
<IncludeInVSIX>true</IncludeInVSIX>
<VSIXSubPath>WebView</VSIXSubPath>
</Content>
</ItemGroup>
</Target>
After upgrading VS to 27703.2022.d15.7, building the project starts failing with this error:
PreComputeCompileTypeScript:
c:\src\WhackWhackTerminal\packages\Microsoft.TypeScript.MSBuild.2.8.3\build\\..\tools\tsc\tsc.exe
--module AMD
--outDir "bin\Debug\js"
--sourcemap
--target ES5
--moduleResolution Node
--noEmitOnError
--listEmittedFiles "c:\src\WhackWhackTerminal\Microsoft.VisualStudio.Terminal\WebView\ts\external.d.ts"
"c:\src\WhackWhackTerminal\Microsoft.VisualStudio.Terminal\WebView\ts\main.ts"
"c:\src\WhackWhackTerminal\Microsoft.VisualStudio.Terminal\WebView\ts\TerminalLinkMatcher.ts"
"c:\src\WhackWhackTerminal\Microsoft.VisualStudio.Terminal\WebView\ts\TermView.ts"
"c:\src\WhackWhackTerminal\Microsoft.VisualStudio.Terminal\WebView\ts\VsEventManager.ts"
c:\src\WhackWhackTerminal\packages\Microsoft.TypeScript.MSBuild.2.8.3\tools\Microsoft.TypeScript.targets(360,5):
error MSB6001: Invalid command line switch for "tsc.exe". Illegal characters in path.
[c:\src\WhackWhackTerminal\Microsoft.VisualStudio.Terminal\Microsoft.VisualStudio.Terminal.csproj]
Done Building Project "c:\src\WhackWhackTerminal\Microsoft.VisualStudio.Terminal\Microsoft.VisualStudio.Terminal.csproj" (default targets) -- FAILED.
I tried executing the same command line as the build did, and it succeeds.
Expected behavior:
Build does not fail
msbuild.binlog.zip
MSBuild log is attached.
@IlyaBiryukov I'm sorry for the trouble this is giving you. Let me look into this and I will get back to you as soon as I can.
@IlyaBiryukov I'm not able to repro this with Visual Studio version 15.7.3 and Microsoft.TypeScript.MSBuild version 2.8.4. Are you still seeing the same issue?
@uniqueiniquity Yep, I can still see it where I saw it first. Though when I cloned the same repo into a different place and applied the same changes, I could not repro the issue, so I'm not blocked.
@IlyaBiryukov are you still able to repro this in the original location? I can't repro on 15.7.4 even when matching your command line exactly.
Yep, still can repro it. Feel free to drop by if you want to debug.
After investigation, turned out to be a corrupted log file (tsc.out).
Deleting and regenerating the log file fixed the issue.
I have no idea where that file would be, but I just had a crash that is giving me the exact same message after changing nothing with my MSBuild or TypeScript configurations. Could anyone tell me where I might be able to find that tsc.out file? Thanks so much in advance.
Hi @nekoyoubi, it'll probably be under
Thanks a ton, @uniqueiniquity. I decided to just let a file search run overnight, and it found the file no problem. I deleted the \obj\ entirely and rebuilt, got a permissions error on ASP.NET temp files (which I thought was really odd), restarted VS as admin on a hunch. All's good now. Thanks much for getting back on this though.
Thanks @uniqueiniquity, we had the same issue. A clean on the project was not enough, we also had to delete the obj folder, afterwards it builds again
Most helpful comment
After investigation, turned out to be a corrupted log file (tsc.out).
Deleting and regenerating the log file fixed the issue.