带敲除功能的asp.net core 2.1 [英] asp.net core 2.1 with knockout
问题描述
我一直在尝试自学.NET Core开发的基本知识,并且我已经开始创建Core 2.1 Web应用程序.我什至已经掌握了EF Core,并拥有了一个可以正常工作的数据库上下文.但是,我很难弄清楚如何实施淘汰赛.我执行了命令
I've been trying to teach myself the ins and outs of .NET Core development, and I've got the start of a Core 2.1 web application created. I've even gotten the hang of EF Core, and have a working DB Context. I am, however, having difficulty figuring out how to implement knockout. I ran the command
dotnet添加ProjectName程序包kickoutjs-版本3.4.2
dotnet add ProjectName package knockoutjs --version 3.4.2
(当然是我的实际项目名称),并且似乎已成功在Dependencies/NuGet节点下添加了剔除功能.点击"knockoutjs(3.4.2),我可以看到文件的存储路径(似乎已经将它们存储在一个中央位置,将用于所有项目).
(with my actual Project Name of course), and it seems to have successfully added knockout under the Dependencies / NuGet node. Clicking on the "knockoutjs (3.4.2), I can see the path where the files are stored (it seems to have stored them in a central location, to be used for all projects).
我不知道的是,我实际上如何引用敲除js文件?在我以前的(非Core)项目中,这就像添加一个脚本src一样简单,指向js文件路径,但是我不知道它在哪里.我本来希望它显示在wwwroot/lib下的某个位置,但我看不到那里列出了淘汰赛js文件(或其他与此相关的文件).我是否缺少使js文件显示在wwwroot下的步骤?
What I can't figure out is, how do I actually reference the knockout js file? In my previous (non Core) projects, it was as simple as adding a script src, pointing to the js file path, but I can't figure out where that is. I would have expected it to show up somewhere under wwwroot/lib, but I don't see the knockout js file listed there (or anywhere else for that matter). Am I missing a step to get the js file to show up under wwwroot?
推荐答案
不幸的是,dotnet add package
现在仅管理服务器端代码.结果,那些由nuget
/dotnet add package
安装的客户端软件包位于我们项目之外的某个地方,而您在wwwroot/
下找不到它们.
Unfortunately, the dotnet add package
only manages the server-side code now . As a result , those client packages installed by nuget
/dotnet add package
are located somewhere outside of our project and you can't find them under the wwwroot/
.
对于那些客户端依赖项,最好使用npm
或LibMan
.顾名思义, LibMan
是Microsoft开发的用于安装和使用客户端依赖项的库管理器. .您可以通过dotnet tool install --global Microsoft.Web.LibraryManager.Cli
For those client dependencies , it's better to use npm
or LibMan
. As the name suggests , the LibMan
is a Library Manager developed by Microsoft used to install and consume client dependencies . You can install the CLI
tool by dotnet tool install --global Microsoft.Web.LibraryManager.Cli
要使用LibMan
安装kickoutjs,只需使用以下命令:
To install knockoutjs with LibMan
, simply use the command below :
libman install knockout
knockout-debug.js
和knockout-min.js
将会存在:
dir wwwroot/lib/knockout
Mode LastWriteTime Length Name
---- ------------- ------ ----
-a---- 9/11/2018 12:38 PM 289595 knockout-debug.js
-a---- 9/11/2018 12:38 PM 60354 knockout-min.js
如果您喜欢GUI方式,可以参考 wiki由Microsoft
if you prefer a GUI way , you can refer the wiki by Microsoft
这篇关于带敲除功能的asp.net core 2.1的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!