Gulp + Bower支持VS2015升级项目 [英] Gulp + Bower support in VS2015 for an upgraded project

查看:180
本文介绍了Gulp + Bower支持VS2015升级项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我基本上试图弄清楚我需要做什么,来创建一个MVC项目(在Visual Studio 2013中创建),就像在Visual Studio 2015中直接创建的新的MVC项目一样。



我注意到的是,我在Visual Studio 2015中看到了一个新创建的项目中更有趣的东西,我相信其中的一些将会很有用,但我无法弄清楚魔法让他们启用。我尝试了一些使用Google搜索,但不幸的是继续找到VS2013支持的教程,这不是我所追求的,我特别想要利用新的VS2015功能。我到目前为止发现的事情:

依赖关系



如何启用依赖关系视图?我已经尝试从一个新项目中复制一个 bower.json 文件,但即使在VS2015重新启动后,我也不会收到这个依赖关系跟踪器。





任务执行者



我如何启用任务跑步者?我尝试创建一个Gulpfile.js,但在输出窗口中出现错误 gulp不被识别为内部或外部命令。我不明白这是一个全新的解决方案,但它看起来好像我的机器上没有安装gulp?

解决方案


如何启用依赖视图?


这是不可能的; Dependencies节点是DNX项目系统的一部分,只在新项目中可用。


如何启用任务运行程序?

p>

除了添加gulpfile之外,还必须添加一个package.json文件,并将gulp添加到其devDependencies部分。其他工具,你将在Gulp中使用,也应该在这里添加。您可以使用新的ASP.NET 5项目作为示例。



您也可以添加一个bower.json文件。 Bower组件将被下载到一个bower_components文件夹中,该文件夹在旧项目系统中将默认隐藏。从New Item模板添加Bower.json还将添加一个.bowerrc文件,该文件将程序包下载位置移至wwwroot / lib。可能不是你想要的MVC项目;你可以改变它为lib,或删除.bowerrc。虽然隐藏的bower_components文件夹很难处理,但它在git中登记时被忽略,这可能是你想要的。


I'm basically trying to figure out what I need to do, to make an MVC project (created in Visual Studio 2013) to behave like a fresh MVC project created directly in Visual Studio 2015.

What I've noticed is that I see more interesting things in Visual Studio 2015 with a newly created project, and I'm sure some of these would be useful, but I can't figure out the magic to get them enabled. I've tried doing some googling but unfortunately keep finding tutorials for VS2013 support which isn't what I'm after, I specifically want to leverage the new VS2015 features. Things that I've spotted so far:

Dependencies

How do I enable the dependency view? I've tried copying a bower.json file from a new project, but even after a restart in VS2015 I don't get this dependencies tracker.

Task Runner

How do I enable the task runner? I tried creating a Gulpfile.js but I get an error in the output window gulp is not recognized as an internal or external command. I don't get this in a brand new solution, but it reads as though gulp isn't installed on my machine?

解决方案

How do I enable the dependency view?

This isn't possible; the Dependencies node is part of the DNX project system and is only available in new projects.

How do I enable the task runner?

In addition to adding the gulpfile, you must add a package.json file, and add "gulp" to its devDependencies section. Other tools you'll be using in Gulp should be added here as well. You can use a new ASP.NET 5 project as an example.

You may want to add a bower.json file as well. Bower components will be downloaded to a bower_components folder, which will be hidden by default in the old project system. Adding Bower.json from the New Item template will also add a .bowerrc file that moves the package download location to wwwroot/lib. Probably not what you want for the MVC project; you could change this to just lib instead, or delete the .bowerrc. While the hidden bower_components folder is harder to work with, it's omitted from checkin in git, which is probably what you want.

这篇关于Gulp + Bower支持VS2015升级项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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