空ASP.Net Core项目中的JavaScript Intellisense [英] JavaScript Intellisense in Empty ASP.Net Core Project

查看:95
本文介绍了空ASP.Net Core项目中的JavaScript Intellisense的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在ASP.Net Core 1.0(461)结构化的应用程序中安装jQuery 2.2.4(作为示例)后,我没有JavaScript智能感知功能.

I do not have JavaScript intellisense working after installing jQuery 2.2.4 (as one example) in a ASP.Net Core 1.0 (461) structured application.

这意味着我们现在有了wwwroot/lib作为脚本包.

This means we now have wwwroot/lib for the script packages.

_references.js文件放在Scripts文件夹中的旧方法不起作用,而且我现在找不到它的归属位置.

The old route of putting a _references.js file in the Scripts folder doesn't work, and I can't find where this belongs now.

如果我在wwwroot中创建一个,则它看起来像这样:

If I create one where in wwwroot, it looks like this:

/// <autosync enabled="true" />
/// <reference path="../_references.js" />
/// <reference path="../Gruntfile.js" />

如果我然后将jQuery.js拖放到此处,则如下所示:

If I then drag-drop jQuery.js into here, it looks like this:

/// <autosync enabled="true" />
/// <reference path="../_references.js" />
/// <reference path="../Gruntfile.js" />
/// <reference path="lib/jquery/jquery.js" />

到目前为止,太好了.但是,如果我右键单击文件并将其更新JavaScript引用",则会拉到jQuery行.

So far, so good. However, if I right-click file and have it "Update JavaScript References", it pulls the jQuery line.

这里正确的方法是什么?我还研究了JavaScript参考的Visual Studio隐式Web"选项设置.

What is the right approach here? I have looked into the Visual Studio "Implicit Web" options settings for JavaScript references also.

推荐答案

您可以右键单击该项目,单击添加",然后将看到 _reference.js 文件的选项,

You can right-click on the project, click add and you will see the option for _reference.js file,

这会将_references.js文件保存到根目录下的Scripts文件夹中,但是此选项不会出现在wwwroot上(不知道为什么,它可能会与ASP.NET Core的工具问题相对,您可以在GitHub上创建有关在此处.)只需将_references.js文件拖到wwwroot(在根目录下),删除Scripts文件夹并确保您已经具有自动同步功能,并开始尝试Bower软件包,并且将相应地更新Bower软件包,而无需手动进行操作.我已经尝试过了,而且效果很好.

This will _references.js file to your Scripts folder at the root, but this option does not appear at wwwroot (Don't know why, it can VS tooling issue for ASP.NET Core you can create an issue on GitHub about this at here.) just drag _references.js file to wwwroot (At root), delete the Scripts folder and make sure that autosync is true that you have already and start trying Bower packages and intellisense file will be updated accordingly without manually doing yourself. I've tried it now and it is working fine.

这篇关于空ASP.Net Core项目中的JavaScript Intellisense的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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