无法将库从 Node_Modules 导入 ASP.NET CORE APP [英] Cannot import libraries from Node_Modules to ASP.NET CORE APP

查看:22
本文介绍了无法将库从 Node_Modules 导入 ASP.NET CORE APP的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在从 Pluralsight 学习 Scott Allen - ASP.Net 核心基础课程,并尝试将来自 Node_Modules 的外部库添加到我的项目中.

I'm learning Scott Allen - ASP.Net Core Fundamental course from Pluralsight and trying to add the external library from Node_Modules to my project.

这是项目的结构:

以及我如何将数据表库包含到我的项目中(添加到 Pages/Shared/_Layout.cshtml)

但是当应用程序运行时,它找不到这些库:

问题:

  1. 这种方式有什么问题?
  2. 你们能提出一些将外部库导入 ASP.NET CORE 应用的有效方法吗?

我使用的是 .NET 5

<PropertyGroup>
   <TargetFramework>net5.0</TargetFramework>
</PropertyGroup>

推荐答案

请注意我们存放静态文件的默认目录是{content root}/wwwroot,你可以移动这些datatables plugin相关js&css 文件到 web 根目录.

Please note that the default directory that we store static files is {content root}/wwwroot, you can move these datatables plugin related js&css files to web root directory.

有关在 ASP.NET Core 中提供静态文件的更多信息,请查看此文档:

For more information about serving static files in ASP.NET Core, please check this doc:

https://docs.microsoft.com/en-us/aspnet/core/fundamentals/static-files?view=aspnetcore-5.0

这篇关于无法将库从 Node_Modules 导入 ASP.NET CORE APP的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆