如何在ASP.Net Core 2.0应用程序中使用Bootstrap? [英] How to use Bootstrap in an ASP.Net Core 2.0 Application?
问题描述
我知道不建议将Bower与ASP.Net Core 2.0一起使用.相反,我使用NuGet将Bootstrap依赖项下载到我的项目中.因此,我无法像以前使用Bower那样使用Layout视图中的文件:
I know that Bower is not recommended to be used with ASP.Net Core 2.0. Instead, I used NuGet to download Bootstrap dependency into my project. Therefore, I can't reference the files in my Layout view like I used to do with Bower using:
<link href="~/lib/bootstrap/dist/css/bootstrap.css" rel="stylesheet" />
我正在尝试使用NuGet来获得更干净的代码.但是,我似乎无法在我的项目中引用此程序包.任何人都有一个想法如何在ASP.Net Core 2.0应用程序中使用/引用通过NuGet安装的引导程序?
I am trying to use NuGet to get a cleaner code. However, I can't seem to be able to reference this package in my project. Anyone has an idea how to use/reference bootstrap installed through NuGet in an ASP.Net Core 2.0 application?
推荐答案
在.NET Core中,Nuget不再适合于部署客户端文件.这是Microsoft做出的设计决定.相反,您可以使用任何客户端构建/部署工具中的任何一个,例如npm,或者我的偏好是简单地链接到CDN位置所需的库.这样可以消除部署问题,并为您的用户提供更好的性能.
In .NET Core, Nuget is no longer suitable for deploying client files. This was a design decision made by Microsoft. Instead, you can use any of a host of client build/deploy tools like npm, or my preference is to simply link to the libraries you need st a CDN location. This eliminates deployment issues and offers better performance for your users.
这篇关于如何在ASP.Net Core 2.0应用程序中使用Bootstrap?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!