简体   繁体   中英

ASP.NET Core 1.0.0 Nuget Dependency issue

Using Visual Studio 2015 Update 3, I created a new ASP.NET Core project (database first). For the client side I needed a lot of javascript libraries like angular, ui-select, select2, breadcrumb, metismenu, gritter, etc. I know some of them are included using Bower package manager but some can only be found using NuGet package manager. Also NuGet has newer versions of packages. So I installed what I was able to find using Bower and then I added the rest using NuGet. After install here is the folders structure:

文件夹结构

Under the Dependency folder you can see a sub-folder for Bower but not for Nuget. I can see the javascript libraries installed with Bower in wwwroot/lib folder but I don't know where are the libraries installed via NuGet. I know that in previous version of ASP the NuGet packages for client were installed in "Content" and "Scripts" folders but since ASP.Net added a "wwwroot" folder they should be put here. Bellow is my project.json file:

{
  "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%" \]
  }
}

How can I refer client libraries installed via NuGet in ASP.NET Core? What path should I use?

请在参考文献 - > .NETCoreApp,Version = v1.0下查看

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM