【发布时间】:2016-12-25 14:20:29
【问题描述】:
我在 VS2015 社区更新 3 版本 14.0.25424.00 中创建了一个虚拟基础项目。 (使用这个很棒的教程:aspnet-core-web-api-angularjs-2)。
这个 angular-2 项目有一些 .ts 文件。
问题:
每次保存文件时都转译(“编译”)为 .js 文件,而是转译 .ts 文件一次且仅在构建时 SERVER-SIDE 项目。 (从 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的帖子,VS2015 update 2中的解决方法是添加到tsconfig文件中:
"compileOnSave": true
但是,这对我的更新 3 版本不起作用。
从 cmd 我运行以下命令:
>tsc -v Version 1.0.3.0
我认为它已经很老了,但我不知道如何更新它,因为正在运行:
>npm install -g typescript@* --save
没有更改当前版本。
你有什么建议? 我很绝望..
TNX,
【问题讨论】:
标签: visual-studio typescript visual-studio-2015 asp.net-core .net-core-rc1