我正在使用VS2017而且我遇到了打字稿编译的麻烦.Ncriptcript版本是2.2.3。我还安装了Typescript.Compiler,Microsoft.TypeScript.Compiler,TypeScript.MSBuildTask,其他主题是安装这些软件包解决了这个问题。我看到很多人都得到了这个错误,但在VS15中,解决方案对我不起作用。
错误是MSB6006“tsc.exe”退出,代码为1。
当我双击它时引用此代码
<Target Name="CompileTypeScriptWithTSConfig"
Condition="'$(BuildingProject)' != 'false' AND '@(ConfigFiles)' != ''"
DependsOnTargets="$(CompileTypeScriptDependsOn)">
<VsTsc
ToolPath="$(TscToolPath)"
ToolExe="$(TscToolExe)"
IsFileSystemCaseSensitive="$(IsFileSystemCaseSensitive)"
TSJavaScriptFile="$(TSJavaScriptFile)"
PreferredUILang="$(PreferredUILang)"
TSConfigFile="%(ConfigFiles.Identity)"
YieldDuringToolExecution="$(TscYieldDuringToolExecution)"
ProjectDir="$(TypeScriptProjectDir)"
ToolsVersion="$(TypeScriptEffectiveToolsVersion)"
TypeScriptCompileBlocked="$(TypeScriptCompileBlocked)"
ComputeOutputOnly="false"
OutputLogFile="$(CompilerOutputLog)">
<Output TaskParameter="GeneratedJavascript" ItemName="emittedFiles" />
</VsTsc>
<ItemGroup>
<GeneratedJavascript Include="@(emittedFiles)" KeepDuplicates="false" />
</ItemGroup>
<AssignTargetPath Files="@(GeneratedJavascript)" RootFolder="$(MSBuildProjectDirectory)">
<Output TaskParameter="AssignedFiles" ItemName="GeneratedJavascriptWithTargetPath" />
</AssignTargetPath>
<ItemGroup>
<FilesForPackagingFromProject Include="@(GeneratedJavascriptWithTargetPath->'%(Identity)')"/>
<ContentWithTargetPath Include="@(GeneratedJavascriptWithTargetPath->'%(Identity)')"/>
<Content Include="@(GeneratedJavascript->'%(Identity)')"/>
</ItemGroup>
</Target>
这是我的tsConfig,遵循指南https://docs.microsoft.com/en-us/scripting/javascript/javascript-in-vs-2017:
{
"compilerOptions": {
"module": "commonjs",
"allowJs": true,
"outDir": "out"
},
"exclude": [
[ "wwwroot/lib" ],
"out"
],
"compileOnSave": true,
"typeAcquisition": {
"enable": true,
}
}