3

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

3 Answers 3

6

I managed to get this working using exclude instead of excludeFiles

"buildOptions": {
  "emitEntryPoint": true,
  "preserveCompilationContext": true,
  "compile": {
    "exclude": ["node_modules"]
  }
},
Sign up to request clarification or add additional context in comments.

Comments

0

did you try with specific file names instead of folder names?

"excludeFiles": ["node_modules/path/to/Page.aspx.cs"]

Comments

0

Solution - In the Solution Explorer, right click on the node_modules folder and click "Exclude From Project"

Reason - If you are working on a client side app that includes npm and node_module folders with large amount of dependencies while using website project in Visual Studio, which is a terrible solution.It results in very slow load times and/or file load errors.

If you have a node_modules folder in your project it will affect the files in the project as well as for publishing. Finally, using a node_modules massive folder in your project there is no way to limit files or folders and end up giving errors.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.