简体   繁体   English

没有网络的LibMan阻止构建。 有本地后备选项吗?

[英]LibMan without internet prevents build. Is there a local fallback option?

I have an aspnet core project (dotnet core 2.2). 我有一个aspnet核心项目(dotnet核心2.2)。 It uses the Microsoft.Web.LibraryManager.Build (1.0.172) package. 它使用Microsoft.Web.LibraryManager.Build (1.0.172)包。 If the network is down, the build fails with a bunch of similar errors: 如果网络中断,构建将失败,并出现许多类似的错误:

Error LIB002 The "toastr.js@2.1.4" library could not be resolved by the "cdnjs" provider C.Web.App C:\\Users\\bburns\\code\\C.WEB.APP\\libman.json 1 错误LIB002“ cdnjs”提供程序C.Web.App C:\\ Users \\ bburns \\ code \\ C.WEB.APP \\ libman.json 1无法解析“ toastr.js@2.1.4”库

libman.json looks like libman.json看起来像

{
  "version": "1.0",
  "defaultProvider": "cdnjs",
  "libraries": [
    {
      "library": "jquery@3.3.1",
      "destination": "wwwroot/lib/jquery"
    },

    ...

Is there a way to specify an offline fallback when cdnjs is unavailable? cdnjs不可用时,是否可以指定脱机回退?

You can save the libs in a local or shared location and reference that in your projects, as in this example of the documentation : 您可以将这些库保存在本地或共享位置,并在您的项目中引用它们,如本文档的示例所示:

{
  "provider": "filesystem",
  "library": "C:\\temp\\lodash\\",
  "files": [
    "lodash.js",
    "lodash.min.js"
  ],

Where library may be a relative path as well. 库也可能是相对路径。

The drawback is that updates are not detected from the project, so you'll have to think of a strategy on how to keep the libraries up-to-date. 缺点是无法从项目中检测到更新,因此您必须考虑如何使库保持最新的策略。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在 Azure DevOps Build Pipeline 中恢复 Libman JS 库 - Restore Libman JS Libraries in Azure DevOps Build Pipeline 在没有互联网的情况下手动同步TFS和本地文件 - sync files on TFS and Local manually without internet 如何在tfs构建中停止自动化的selenium测试套件。 取消Build后,测试继续运行。 - How to stop a automated selenium test suite in tfs build. Tests keep running after cancelling Build. 如何在没有互联网连接(仅本地主机)的情况下发送和发送电子邮件? - How to send and email without internet connection,only local host? 本地ASP.NET网站不能在没有Internet的情况下运行 - Local ASP.NET Website doesn't run without Internet 在Visual Studio版本中找出DLL的来源。 - Find out where DLL is coming from in Visual Studio build. ItextSharp 在 PC 版本中生成 0 字节的 pdf 文件。 在编辑器中工作 - ItextSharp generates pdf file of 0 bytes in PC build. Works in editor Admob 在 android 版本中不起作用。 在统一编辑器中完美运行 - Admob not working in android build. Works perfectly in unity editor 错误:构建恢复了 NuGet 包。 再次构建项目以在构建中包含这些包。 想要查询更多的信息 - Error: The build restored NuGet packages. Build the project again to include these packages in the build. For more information LibMan遇到问题 - Having issues with LibMan
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM