4

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:

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?

2
  • I found in project.lock.json file, a section that describes the path of libraries supposed to be installed by Nuget Ex: "libraries": { "Angular.UI.UI-Router/0.2.18": { "sha512": "...", "type": "package", "path": "Angular.UI.UI-Router/0.2.18", "files": [ "Angular.UI.UI-Router.0.2.18.nupkg.sha512", "Angular.UI.UI-Router.nuspec", "content/scripts/angular-ui-router.js", "content/scripts/angular-ui-router.min.js" ] }, but files are missing from the project. Commented Jul 11, 2016 at 6:32
  • Did anyone figure this out? I'm facing the same issue, with all answers so far saying "use NPM", but that doesn't seem to answer the root question... Commented Dec 24, 2017 at 20:10

1 Answer 1

1

Please check under References --> .NETCoreApp,Version=v1.0

Sign up to request clarification or add additional context in comments.

1 Comment

There is nothing important there @BalaSakthis. I can see the list of installed packages and even their location but that path is not to be used on the project. I need a path that is related to my project.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.