JavaScript Intellisense in Empty ASP.Net Core Project

对着背影说爱祢 提交于 2020-01-05 04:04:40

问题


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.

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

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.

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

/// <autosync enabled="true" />
/// <reference path="../_references.js" />
/// <reference path="../Gruntfile.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" />

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

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


回答1:


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

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.



来源:https://stackoverflow.com/questions/37514269/javascript-intellisense-in-empty-asp-net-core-project

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!