1
votes

The "Compile on save" feature isn't working for me in my Visual Studio 2015 with update 3.I am start working on Angular2 project with MVC5.Thats why I need to re compile or when change in .ts file is detect and show updated output on my browser.

my tsconfig.json file have below code:

{
    "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"
 ]
}

I have Typescript 2.4.1.0 tools for Visual Studio 2015 installed. Image Ref:

enter image description here

or in my PC I have Typescript 2.4.1 is installed. Image Ref: enter image description here

I also tried to add entry in path variable. As Ref in this link and Image: enter image description here

I checked my typescript version is updated or out dated but I found this:

enter image description here

This is my .csproc file code:

<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>

I also check Image Ref:

enter image description here

Last one which I try and got error is on the below link from which I follow Mikaƫl Mayer answer:

Here is my error which I got while building:

Severity Code Description Project File Line Suppression State Error The specified task executable "cmd.exe" could not be run. The working directory "F:\Projects\ecommerce\ecommerce\js" does not exist. ecommerce F:\Projects\ecommerce\ecommerce\ecommerce.csproj 352

Image: enter image description here

Below is the other references on which I tried but nothing is working for me:

Ref#1

Ref#2

Ref#3

Ref#4

Ref#5

Ref#6

1

1 Answers

-1
votes

I've experienced a similar problem in the past and I resolved it by changing the project property:

<TypeScriptCompileOnSaveEnabled>True</TypeScriptCompileOnSaveEnabled>

This can be found on the Typescript Build tab of the project properties:

Compile on save

Hope this gets you going. Good luck!