project.json exlcudeFiles无效

时间:2016-11-24 12:37:25

标签: asp.net-core .net-core project.json

我有一个使用.net核心版本1制作的项目。 这是一个SPA,我在测试期间有一个我想要的文件,但是在发布时我希望它被排除在外。

我已阅读:https://docs.microsoft.com/en-us/dotnet/articles/core/tools/project-json,其中所说的是将排除 excludeFiles 添加到 publishOptions 对象。 所以,我已经尝试过,似乎没有任何效果。

这是我的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%" ]
  }
}

有人能告诉我我做错了吗?

1 个答案:

答案 0 :(得分:1)

您可能希望从wwwroot中排除,因此正确的补丁

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

从主项目目录

开始的Excludig补丁