2016-03-02 184 views
2

我有一个MVC 5项目,我使用打字稿。 现在我必须实现新功能,我打开其他打字稿的实现方式。 我试图使用typescript 1.8的多个tsconfig.json文件新功能,我在每个文件夹上有两个文件夹:typescriptE21typescript以及一个tsconfig.json文件。Visual Studio 2015项目上的多个tsconfig [typescript 1.8]

第一:

{ 
    "compilerOptions": { 
     "removeComments": false, 
     "sourceMap": false, 
     "target": "es5", 
     "noImplicitAny": false, 
     "module": "amd", 
     "declaration": false, 
     "noEmitOnError": true, 
     "emitDecoratorMetadata": true, 
     "experimentalDecorators": true, 
     "inlineSourceMap": true, 
     "inlineSources": true 
    }, 
    "compileOnSave": true, 
    "exclude": [ 
     "node_modules", 
     "typescript" 
    ] 
} 

与第二:

{ 
    "compilerOptions": { 
     "removeComments": false, 
     "sourceMap": false, 
     "target": "es5", 
     "noImplicitAny": false, 
     "module": "system", 
     "declaration": false, 
     "noEmitOnError": true, 
     "emitDecoratorMetadata": true, 
     "experimentalDecorators": true, 
     "inlineSourceMap": true, 
     "inlineSources": true 
    }, 
    "compileOnSave": true, 
    "exclude": [ 
     "node_modules", 
     "typescript21", 
     "scripts" 
    ] 
} 

当我打开打字稿部分项目属性说检测到“一个或多个tsconfig.json文件项目属性被禁用。 “这是正确的,但是当我运行该应用程序我得到这个错误:

Build: Experimental support for decorators is a feature that is subject to change in a future release. Set the 'experimentalDecorators' option to remove this warning

上的文件:

import {Component} from "ngts/ngts"; 

@Component({ 
    template: `<div md-scroll-y flex class="md-padding" id="contenido">Contenido</div>` 
}) 
export class EmAplicacion { 

} 

在这两个tsconfig.json文件,我已经激活了装修,但似乎打字稿没有得到从那里的编译器选项...

此外,当我不使用装饰器,它编译,但我可以看到结果文件,他们是使用AMD模块系统,当我已经把“系统”在seco nd配置文件...

什么问题?

回答

2

真正的问题是,tsconfig.json文件都包含在prject为:

<None Include="typescript\tsconfig.json" /> 

我必须改变它;

<Content Include="typescript\tsconfig.json" /> 

和所有它的确定

+0

你在哪里做这个? 什么文件? – Sam

+0

我在.csproj文件上做。 –

0

这也将帮助:

  1. 打开Solution Explorer中
  2. 右键单击tsconfig.json文件,并选择 '从项目中排除'。
  3. 您可能会看到tsconfig.json从解决方案资源管理器中消失。在这种情况下,请从解决方案资源管理器工具栏顶部的 中选择“显示所有文件”选项。
  4. 右键单击tsconfig.json并选择'Include In Project'。
相关问题