使用Visual Studio 2015 Update 3,我创建了一个新的ASP.NET Core项目(数据库优先)。对于客户端,我需要很多javascript库,如angular,ui-select,select2,breadcrumb,metismenu,gritter等。我知道其中一些是使用Bower包管理器包含但有些只能使用NuGet包管理器找到。此外,NuGet还有更新版本的软件包。 所以我安装了我能用Bower找到的东西,然后我用NuGet添加了其余部分。安装后这里是文件夹结构:
在Dependency文件夹下,您可以看到Bower的子文件夹,但不能看到Nuget的子文件夹。 我可以在wwwroot / lib文件夹中看到与Bower一起安装的javascript库,但我不知道通过NuGet在哪里安装库。我知道在以前版本的ASP中,客户端的NuGet包安装在“内容”和“脚本”文件夹中,但是由于ASP.Net添加了一个“wwwroot”文件夹,所以应该放在这里。 贝娄是我的project.json文件:
{
"userSecretsId": "aspnet-CipoCloud-7dc0416a-50c0-486e-8b0d-dbe26539c996",
"dependencies": {
"Microsoft.NETCore.App": {
"version": "1.0.0",
"type": "platform"
},
"Microsoft.ApplicationInsights.AspNetCore": "1.0.0",
"Microsoft.AspNetCore.Authentication.Cookies": "1.0.0",
"Microsoft.AspNetCore.Diagnostics": "1.0.0",
"Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore": "1.0.0",
"Microsoft.AspNetCore.Identity.EntityFrameworkCore": "1.0.0",
"Microsoft.AspNetCore.Mvc": "1.0.0",
"Microsoft.AspNetCore.Razor.Tools": {
"version": "1.0.0-preview2-final",
"type": "build"
},
"Microsoft.AspNetCore.Server.IISIntegration": "1.0.0",
"Microsoft.AspNetCore.Server.Kestrel": "1.0.0",
"Microsoft.AspNetCore.StaticFiles": "1.0.0",
"Microsoft.EntityFrameworkCore.SqlServer": "1.0.0",
"Microsoft.EntityFrameworkCore.SqlServer.Design": {
"version": "1.0.0",
"type": "build"
},
"Microsoft.EntityFrameworkCore.Tools": {
"version": "1.0.0-preview2-final",
"type": "build"
},
"Microsoft.Extensions.Configuration.EnvironmentVariables": "1.0.0",
"Microsoft.Extensions.Configuration.Json": "1.0.0",
"Microsoft.Extensions.Configuration.UserSecrets": "1.0.0",
"Microsoft.Extensions.Logging": "1.0.0",
"Microsoft.Extensions.Logging.Console": "1.0.0",
"Microsoft.Extensions.Logging.Debug": "1.0.0",
"Microsoft.Extensions.Options.ConfigurationExtensions": "1.0.0",
"Microsoft.VisualStudio.Web.BrowserLink.Loader": "14.0.0",
"Microsoft.VisualStudio.Web.CodeGeneration.Tools": {
"version": "1.0.0-preview2-final",
"type": "build"
},
"Microsoft.VisualStudio.Web.CodeGenerators.Mvc": {
"version": "1.0.0-preview2-final",
"type": "build"
},
"Angular.UI.UI-Router": "0.2.18",
"AngularJS.Sanitize": "1.5.7",
"jQuery.Gritter": "1.7.4",
"Newtonsoft.Json": "9.0.1",
"metisMenu": "2.4.0",
"ncuillery.angular-breadcrumb": "0.4.1"
},
"tools": {
"Microsoft.AspNetCore.Razor.Tools": "1.0.0-preview2-final",
"Microsoft.AspNetCore.Server.IISIntegration.Tools": "1.0.0-preview2-final",
"Microsoft.EntityFrameworkCore.Tools": "1.0.0-preview2-final",
"Microsoft.Extensions.SecretManager.Tools": "1.0.0-preview2-final",
"Microsoft.VisualStudio.Web.CodeGeneration.Tools": {
"version": "1.0.0-preview2-final",
"imports": \[
"portable-net45+win8"
\]
}
},
"frameworks": {
"netcoreapp1.0": {
"imports": \[
"dotnet5.6",
"portable-net45+win8"
\]
}
},
"buildOptions": {
"emitEntryPoint": true,
"preserveCompilationContext": true
},
"runtimeOptions": {
"configProperties": {
"System.GC.Server": true
}
},
"publishOptions": {
"include": \[
"wwwroot",
"Views",
"Areas/**/Views",
"appsettings.json",
"web.config"
\]
},
"scripts": {
"prepublish": \[ "bower install", "dotnet bundle" \],
"postpublish": \[ "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" \]
}
}
如何在ASP.NET Core中引用通过NuGet安装的客户端库?我应该使用什么路径?
答案 0 :(得分:1)
请在参考资料 - >下查看.NETCoreApp,版本= 1.0 强>