C# 将 jquery 添加到 Visual Studio 中的“空”Web 项目的最佳方法?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/10196761/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-09 12:50:38  来源:igfitidea点击:

best way to add jquery to an "empty" web project in visual studio?

c#jqueryasp.netsolution

提问by chilleo

Hey so when i start a new solution and pick "web application" visual studio goes ahead and by default creates a script folder with jquery-1.4.1.js, jquery-1.4.1.min.js, and jquery-1.4.1-vsdoc.js. But if I instead start a new solution and pick "empty web application" there are no folders which is to be expected obviously. I am just wondering what is the best way to add jquery into my new project, should i just copy and paste the scripts folder from a default web application?

嘿,所以当我开始一个新的解决方案并选择“Web 应用程序”时,visual studio 会继续,默认情况下会创建一个包含 jquery-1.4.1.js、jquery-1.4.1.min.js 和 jquery-1.4.1 的脚本文件夹-vsdoc.js。但是,如果我改为开始一个新的解决方案并选择“空 Web 应用程序”,则显然没有任何文件夹是可以预期的。我只是想知道将 jquery 添加到我的新项目的最佳方法是什么,我应该从默认的 Web 应用程序复制并粘贴脚本文件夹吗?

thanks in advance!

提前致谢!

回答by amdmax

Use nuget package http://nuget.org/packages/jquery

使用 nuget 包 http://nuget.org/packages/jquery

The command is "Install-Package jQuery"

命令是“Install-Package jQuery”

回答by Dervall

Use NuGet! It will install things in the proper folders, and keep track of things for you. No reason to do this yourself anymore.

使用 NuGet!它将把东西安装在适当的文件夹中,并为你跟踪东西。没有理由自己再这样做了。

Right click on your solution, choose manage packages. Search for jquery and install it. You might need to install the Nuget package manager if you haven't got it already.

右键单击您的解决方案,选择管理包。搜索 jquery 并安装它。如果你还没有安装 Nuget 包管理器,你可能需要安装它。

回答by naim shaikh

Or may be you can make a collection of needed files every time you use in your project and paste that files to empty project...

或者您可以在每次在项目中使用时制作所需文件的集合并将这些文件粘贴到空项目中...

回答by ZERO

You can just create a folder call script and drag the jquery libary into that folder(or use add exisitng item). New version Jquery library is available for download on http://docs.jquery.com/Downloading_jQuery

您只需创建一个文件夹调用脚本并将 jquery 库拖到该文件夹​​中(或使用添加现有项)。新版本的 Jquery 库可以在http://docs.jquery.com/Downloading_jQuery 上下载