2017-07-07 53 views
1

在Visual Studio 2015中更新3时,“保存时编译”功能不适用于我。我开始使用MVC5.Thats开发Angular2项目为什么我需要重新编译或者.ts文件中的更改被检测到并在浏览器上显示更新的输出。Typescript“保存时编译”不适用于VS 2015更新3

我tsconfig.json文件中有如下代码:

{ 
    "compilerOptions": { 
    "target": "es5", 
    "module": "commonjs", 
    "moduleResolution": "node", 
    "sourceMap": true, 
    "emitDecoratorMetadata": true, 
    "experimentalDecorators": true, 
    "lib": [ "es2015", "dom" ], 
    "noImplicitAny": false, 
    "suppressImplicitAnyIndexErrors": true 
}, 
"compileOnSave": true, 
    "exclude": [ 
    "node_modules/*", 
    "**/*-aot.ts" 
] 
} 

我打字稿2.4.1.0工具安装Visual Studio 2015年。图片编号:

enter image description here

或在我的电脑我有打字稿2.4.1安装。图片编号: enter image description here

我也尝试添加条目的路径变量。作为参考在此 link和图像: enter image description here

我检查了我的打字稿版本更新或过时,但我发现这一点:

enter image description here

这是我.csproc文件代码:

<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> 
    <TypeScriptCompileOnSaveEnabled>true</TypeScriptCompileOnSaveEnabled> 
    <TypeScriptRemoveComments>true</TypeScriptRemoveComments> 
    <TypeScriptSourceMap>false</TypeScriptSourceMap> 
</PropertyGroup> 

<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> 
    <TypeScriptCompileOnSaveEnabled>True</TypeScriptCompileOnSaveEnabled> 
    <TypeScriptNoImplicitAny>False</TypeScriptNoImplicitAny> 
    <TypeScriptModuleKind>CommonJS</TypeScriptModuleKind> 
    <TypeScriptRemoveComments>False</TypeScriptRemoveComments> 
</PropertyGroup> 

我也检查图片编号:

enter image description here

最后一个,我尝试和遇到错误是下面的链接从我跟随 Mikaël Mayer answer

这是我的错误,我得到了,而建筑:

严重性代码描述项目文件行抑制状态 错误指定的任务可执行文件“cmd.exe”无法运行。工作目录“F:\ Projects \ ecommerce \ ecommerce \ js”不存在。电子商务F:\ Projects \ ecommerce \ ecommerce \ ecommerce。的csproj 352

图片: enter image description here

下面是关于这一点我试过,但没有什么工作对我来说,其他参考:

Ref#1

Ref#2

Ref#3

Ref#4

Ref#5

Ref#6

回答

0

我已经经历了过去类似的问题,我通过更改项目性质解决它:

<TypeScriptCompileOnSaveEnabled>True</TypeScriptCompileOnSaveEnabled> 

这可以在找到Typescript Build项目属性选项卡:

Compile on save

希望这会让你走。祝你好运!

+0

我在我的项目文件夹中有'tsconfig.json',这就是为什么上面的项目属性为我禁用。 –

+0

啊。我道歉。我错过了你已经完成了上述。 (我以某种方式错过了.csproj的片段) – nickflynn

+0

也许退一步,先尝试每一件事。在VSCode或命令行中运行构建,以确保编译时保存在那里。如果是这样,然后删除tsconfig,看看是否只使用Visual Studio MSBuild任务(csproj和项目属性选项卡)将工作。我已经看到很多实例 - 尽管声明支持 - 尝试在Visual Studio 2015内部使用tsconfig有问题/冲突。 –

相关问题