简体   繁体   中英

Exclude TypeScript files from Web Publish VS 2015

Is there are any way to exclude the TypeScript files on web publish ? becouse we do not need to publish those files

  • my TS files locate on the wwwroot

here is my tsconfig.json

{
  "compilerOptions": {
    "target": "es5",
    "module": "commonjs",
    "moduleResolution": "node",
    "sourceMap": true,
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "lib": [ "es2015", "dom" ],
    "noImplicitAny": true,
    "suppressImplicitAnyIndexErrors": true

  },

  "exclude": [
    "node_modules"

  ],
  "compileOnSave": true
}

When you do Web Publish the dotnet publish is called to gather the files to publish to a temporary folder. And dotnet publish by default uses project.json file as configuration source.

Look into publishOptions section in project.json . There you can specify "exclude" and ""excludeFiles" subsections. Form "Structure to include/exclude files" part of documentation :

"exclude" string/string[]

A list of file globbing patterns for files to exclude. The exclude patterns have higher priority than the include patterns, hence a file found in both will be excluded. The patterns are rooted at the project folder. Defaults to none.

"excludeFiles" string/string[]

A list of file paths to exclude. The paths are rooted at the project folder. This list has a higher priority than globbing patterns and the include paths, hence a file found in all will be excluded. Defaults to none.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM