FloatingKiwi FloatingKiwi - 2 months ago 14
C# Question

asp.net core exclude files from the build

I'm trying to add Protractor to my asp.net-core application.

I added it via npm and it installs the selenium-webdriver which contains a file

Page.aspx.cs
. This is causing a build error but my project doesn't even need to compile it.

So I'm trying to exclude node_modules using project.json

"buildOptions": {
"emitEntryPoint": true,
"preserveCompilationContext": true,
"compile": {
"excludeFiles": "node_modules"
}
},


Gives
Illegal characters in path
as does:

"excludeFiles": ["node_modules"]


This seems to be related to the _ character but I can't work out why that would be an issue.

Thanks

Answer

I managed to get this working using exclude instead of excludeFiles

"buildOptions": {
  "emitEntryPoint": true,
  "preserveCompilationContext": true,
  "compile": {
    "exclude": ["node_modules"]
  }
},