[英]asp.net core exclude files from the build
我正在嘗試將Protractor添加到我的asp.net核心應用程序中。
我通過npm添加它,它安裝了包含文件Page.aspx.cs
的selenium-webdriver。 這導致了構建錯誤,但我的項目甚至不需要編譯它。
所以我試圖使用project.json排除node_modules
"buildOptions": {
"emitEntryPoint": true,
"preserveCompilationContext": true,
"compile": {
"excludeFiles": "node_modules"
}
},
Illegal characters in path
給出Illegal characters in path
如下所示:
"excludeFiles": ["node_modules"]
這似乎與_字符有關,但我無法弄清楚為什么這會是一個問題。
謝謝
我設法使用exclude
而不是excludeFiles
來實現這一點
"buildOptions": {
"emitEntryPoint": true,
"preserveCompilationContext": true,
"compile": {
"exclude": ["node_modules"]
}
},
你嘗試使用特定的文件名而不是文件夾名嗎?
"excludeFiles": ["node_modules/path/to/Page.aspx.cs"]
解決方案 - 在解決方案資源管理器中 , 右鍵單擊 node_modules文件夾,然后單擊“從項目中排除”
原因 - 如果您正在使用包含具有大量依賴關系的npm和node_module文件夾的客戶端應用程序,而在Visual Studio中使用網站項目,這是一個非常糟糕的解決方案。這會導致加載時間和/或文件加載錯誤非常慢。
如果項目中有node_modules文件夾,它將影響項目中的文件以及發布。 最后,在項目中使用node_modules大量文件夾,無法限制文件或文件夾,最終會出錯。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.