我创建了一个虚拟基本项目VS2015 社区更新 3,版本 14.0.25424.00。
(使用这个很棒的教程:aspnet-core-web-api-angularjs-2 http://www.talkingdotnet.com/cascading-dropdown-list-aspnet-core-web-api-angularjs-2/ ).
这个 angular-2 项目有一些 .ts 文件。
问题:
而不是被转译(“编译”)为 .js 文件每次保存文件时,正在转译的 .ts 文件一次且仅在 BUILD 中服务器端项目的时间。
(在 Visual Studio 中单击 F5)。
我谷歌了一下,发现我应该添加“watch”:true
到 tsconfig.json 文件:
{
"compilerOptions": {
"noImplicitAny": false,
"noEmitOnError": true,
"removeComments": false,
"sourceMap": true,
"target": "es5",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"module": "system",
"moduleResolution": "node",
"watch": true
},
"exclude": [
"node_modules",
"wwwroot/lib"
]
}
但是,现在我在构建时遇到错误:
错误“JsErrorScriptException (0x30001)”。 ASPNETCoreAngular2Demo C:\Visual Studio 2015\Projects\ASPNETCoreAngular2Demo\src\ASPNETCoreAngular2Demo\未知输出 1
根据this https://github.com/Microsoft/TypeScript/issues/7362帖子中,VS2015 update 2中的解决方案是在tsconfig文件中添加:
"compileOnSave": true
然而,这在我的 update 3 版本中对我不起作用。
我从 cmd 运行以下命令:
>tsc -v
Version 1.0.3.0
我认为这已经很旧了,但我不知道如何更新它,因为正在运行:
>npm install -g typescript@* --save
没有改变当前版本。
你有什么建议?
我很绝望..
TNX,