TscToolPath null in Microsoft.TypeScript.targets after installed update 3 of visual studio 2015

邮差的信 提交于 2019-12-12 13:28:28

问题


I get this error in visual studio 2015 after installing update 3. Using TS 2.0.

Error       Invalid command line switch for "tsc.exe". Value cannot be null.
Parameter name: path1   ProjectTest C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\TypeScript\Microsoft.TypeScript.targets 214 

This points to this code so i think TscToolPath is null

 <VsTsc
      ToolPath="$(TscToolPath)"
      ToolExe="$(TscToolExe)"
      TSConfigFile="%(ConfigFiles.Identity)"
      YieldDuringToolExecution="$(TscYieldDuringToolExecution)"
      ProjectDir="$(ProjectDir)"
      ToolsVersion="$(TypeScriptToolsVersion)"
      TypeScriptCompileBlocked="$(TypeScriptCompileBlocked)"
      ComputeOutputOnly="false">

      <Output TaskParameter="GeneratedJavascript" ItemName="emittedFiles" />
  </VsTsc>

I can't find that TscToolPath value anywhere. I have this in Microsoft.Typescript.Default.props

 <PropertyGroup>
    <TypeScriptTarget>ES5</TypeScriptTarget>
    <TypeScriptCompileOnSaveEnabled>true</TypeScriptCompileOnSaveEnabled>
    <TypeScriptNoImplicitAny>false</TypeScriptNoImplicitAny>
    <TypeScriptRemoveComments>false</TypeScriptRemoveComments>
    <TypeScriptGeneratesDeclarations>false</TypeScriptGeneratesDeclarations>
    <TypeScriptSourceMap>true</TypeScriptSourceMap>
    <TypeScriptNoEmitOnError>true</TypeScriptNoEmitOnError>
  </PropertyGroup>

My TS config in .iceproj (telerik appbuilder)

 <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|AnyCPU'">
    <TypeScriptTarget>ES5</TypeScriptTarget>
    <TypeScriptJSXEmit>None</TypeScriptJSXEmit>
    <TypeScriptModuleKind>AMD</TypeScriptModuleKind>
    <TypeScriptOutFile />
    <TypeScriptOutDir />
    <TypeScriptNoEmitOnError>False</TypeScriptNoEmitOnError>
    <TypeScriptSourceMap>False</TypeScriptSourceMap>
    <TypeScriptMapRoot />
    <TypeScriptSourceRoot />
    <TypeScriptNoImplicitAny>False</TypeScriptNoImplicitAny>
  </PropertyGroup>

Added this to iceproj but didn't fix.

   <PropertyGroup>
     <TypeScriptToolsVersion>2.0</TypeScriptToolsVersion>
  </PropertyGroup>

Please help :)


回答1:


Hopefully, the same steps work for v2 of TypeScript for you (I'm still using 1.8), but the same error while trying to run the project.

So how did I fix it... (it's possibly OK to skip to part 4, not certain after all my changes)

Part 1.

Ensure the TypeScript options are set in Visual Studio.

Part 2.

Add a tsconfig.json file.

{
  "compilerOptions": {
    "module": "amd",
    "target": "es5",
    "sourceMap": true,
    "experimentalDecorators": true,
    "noEmitOnError": false
  },
  "compileOnSave": true,
  "exclude": [
    "node_modules",
    "bower_components",
    "platforms"
  ]
}

Part 3.

I ended up getting rid of all my current typing files from nuget and slowly replaced them all using typings. Mostly due to errors returned in part 4. Rxjs being one of the ringleaders to my problems.

Part 4.

run tsc from the command prompt. This will reveal any errors with your files. Basically, AppBuilder did use to continue with errors but for some reason, at the moment it is not building without errors. Something as simple as typings/globals/cordova-ionic/index.d.ts(4,12): error TS2503: Cannot find namespace 'Ionic'. will cause it to fail but then getting a few more typescript definitions fixes it: typings install dt~cordova-ionic/plugins/keyboard --global --save

Part 5.

When there are finally no more errors returned by tsc try to run appbuilder from Visual Studio again. This time, the Device Simulator came up.

Hopefully, those steps fix your problems as well. Good Luck. Any additional from tsc then add them to your question if you cant work them out.

TypeScript 2 update

I've installed TypeScript 2 RC and it seems to run from that automatically (without changing the project file). Building or running the project the output gives: C:\Program Files (x86)\Microsoft SDKs\TypeScript\2.0\tsc.exe --project "H:\WhatsMyScore1\WhatsMyScore\MobileProject1\tsconfig.json" --listEmittedFiles



来源:https://stackoverflow.com/questions/39039055/tsctoolpath-null-in-microsoft-typescript-targets-after-installed-update-3-of-vis

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!