“tsc.exe” exited with code 1

2020-03-26 08:02发布

问题:

I'm using asp.net mvc and angular 2. I updated Angular to version 2.1.1. Now when I compile, the "tsc.exe" exited with code 1 error popped up. My Typescript files do not see the library files.

What could be the problem?

, .

update

When I installed Typescrypt.Compiller 2.0.3 and Typescrypt.MSBuild 2.0.3, I got two new bugs:

  1. "The "OutputLogFile" parameter is not supported by the "VsTsc" task. Verify the parameter exists on the task, and it is a settable public instance property." and
  2. The "VsTsc" task could not be initialized with its input

fixed

I removed from project TypeScript.Compiler and TypeScript.MSBuild. Don't now why i installed this. =) Then downloaded new version TypeScript Tools for Visual Studio 2015 (TypeScript_Dev14Full.exe) and installed. It's solution my problem.

回答1:

I removed from project TypeScript.Compiler and TypeScript.MSBuild. Don't now why i installed this. =) Then downloaded new version TypeScript Tools for Visual Studio 2015 (TypeScript_Dev14Full.exe) and installed. It's solution my problem.



回答2:

I had a similar issue. First we would have to consider whether Visual Studio is the right way to build Angular 2 projects. If we determine that its the best approach then this is the solution I found to the error...

As it turns out the VsTsc task does support OutputLogFile. When I installed the newer TypeScript nuget packages (Microsoft.TypeScript.Compiler and Microsoft.TypeScript.MSBuild) then it adds Microsoft.TypeScript.targets to the .csproj but neglects to remove the previous lines. Nuget will add lines similar to

<Import Project="..\packages\Microsoft.TypeScript.MSBuild.2.1.4\build\Microsoft.TypeScript.MSBuild.props" Condition="Exists('..\packages\Microsoft.TypeScript.MSBuild.2.1.4\build\Microsoft.TypeScript.MSBuild.props')" />

<Import Project="..\packages\Microsoft.TypeScript.MSBuild.2.1.4\build\Microsoft.TypeScript.MSBuild.targets" Condition="Exists('..\packages\Microsoft.TypeScript.MSBuild.2.1.4\build\Microsoft.TypeScript.MSBuild.targets')" />

You have to manually removed the two lines pointing to :

<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')" />


回答3:

Close VS and then download your TypeScript Tools. You can get the tools here https://www.microsoft.com/en-us/download/confirmation.aspx?id=48593

When finished up VS and rebuild. You should be good.