r3plica
r3plica

Reputation: 13367

project.json exlcudeFiles not working

I have a project that I have made using .net core version 1. It is a SPA and I have a file that I want during testing, but when publishing I want it to be excluded.

I have read: https://learn.microsoft.com/en-us/dotnet/articles/core/tools/project-json and all it says is to add either exclude or excludeFiles to the publishOptions object. So, I have tried that and nothing seems to work.

Here is my project.json:

{
  "dependencies": {
    "Microsoft.NETCore.App": {
      "version": "1.0.0",
      "type": "platform"
    },
    "Microsoft.AspNetCore.Server.IISIntegration": "1.0.0",
    "Microsoft.AspNetCore.Server.Kestrel": "1.0.0",
    "Microsoft.AspNetCore.StaticFiles": "1.0.0",
    "Microsoft.AspNetCore.Routing": "1.0.0"
  },

  "tools": {
    "Microsoft.AspNetCore.Server.IISIntegration.Tools": "1.0.0-preview2-final"
  },

  "frameworks": {
    "netcoreapp1.0": {
      "imports": [
        "dotnet5.6",
        "portable-net45+win8"
      ]
    }
  },

  "buildOptions": {
    "emitEntryPoint": true,
    "preserveCompilationContext": true
  },

  "runtimeOptions": {
    "configProperties": {
      "System.GC.Server": true
    }
  },

  "publishOptions": {
    "include": [
      "wwwroot",
      "web.config"
    ],
    "exclude": [ "js/constants.*" ],
    "excludeFiles": [ "js/constants.min.js" ]
  },

  "scripts": {
    "postpublish": [ "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" ]
  }
}

Can someone tell me what I am doing wrong?

Upvotes: 0

Views: 50

Answers (1)

J. Doe
J. Doe

Reputation: 2747

You propably want to exclude from wwwroot so proper patch will be

"exclude": [ "wwwroot/js/constants.*" ],
"excludeFiles": [ "wwwroot/js/constants.min.js" ]

Excludig patch starting from main project directory

Upvotes: 1

Related Questions