如何在 Visual Studio 2017 中使用 bower 包 [英] How to use bower packages in Visual Studio 2017

查看:47
本文介绍了如何在 Visual Studio 2017 中使用 bower 包的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 vs2017 中使用 bower 包管理器面临两个困难

Face two difficulties with bower package manager in vs2017

  1. 在Visual Studio 2017中,在bower.json下找不到.bowerrc文件,那么如何设置目录属性呢?通过Manage Bower Packages UI安装后,包将文件存储在bower_components文件夹

  1. In Visual Studio 2017, can not find any .bowerrc file under bower.json, so how to set the directory property? After Installation via Manage Bower Packages UI, packages store files in bower_components folder

如何使用这些包,就像在以前的版本(如 VS 2013)中,在 BundleConfig.cs 中编写语法来管理客户端包,如下所示.现在在 VS 2017 中,如何在 C# Core 2 ASP.NET MVC 项目中使用这些包?

How to use those packages, as in previous versions like VS 2013 write syntax in BundleConfig.cs to manage client packages like below. Now in VS 2017, how to use those packages in a C# Core 2 ASP.NET MVC project?

BundleConfig.cs:

public class BundleConfig
{
    public static void RegisterBundles(BundleCollection bundles)
    {
        bundles.Add(new ScriptBundle("~/bundles/jquery").Include(
                    "~/bower_components/jquery/dist/jquery.js",
                    "~/bower_components/jquery-file-upload/js/vendor/jquery.ui.widget.js",
                    "~/bower_components/jquery-file-upload/js/jquery.fileupload.js",
                    "~/bower_components/jquery-file-upload/js/jquery.iframe-transport.js")); 
    }
}

推荐答案

我也遇到了同样的问题.

I had the same issue.

在与 bower.json 文件相同的文件夹中,创建名为 .bowerrc 的文件.在里面粘贴:

In the same folder as your bower.json file create the file called .bowerrc. Inside it paste:

{
  "directory": "wwwroot/lib"
}

这篇关于如何在 Visual Studio 2017 中使用 bower 包的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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