Solving bower and bundling errors in imported ASP.NET Core projects

For some ASP.NET Core projects errors related to bower and bundling may appear after project is moved to csproj file from previous project.json format. This blog post introduces how I got these errors solved for imported project.

The most popular errors you get are these:

  • “bower install” exited with code 9009
  • no executable found matching command “dotnet-bundle”

Solving bower errors

  1. Make sure you have Nodejs installed on your machine
  2. Make sure you have bower package installed on your machine
  3. Make sure you have npm folder in your PATH variable

To make sure you can run bower open command line and type ”bower”.

Solving bundling errors

Usually after bower problems come dotnet-bundle error. This comes down to one missing line in csproj file.

  1. Add reference to BundleMinifier.Core and BuildBundlerMinifier NuGet packages.
  2. Open project files in editor
  3. Make sure you have DotNetCliToolReference to bundle minifier:
  4. <ItemGroup>
      <DotNetCliToolReference Include="Microsoft.Extensions.SecretManager.Tools" Version="1.0.0" />
      <DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="1.0.0" />
      <DotNetCliToolReference Include="BundlerMinifier.Core" Version="2.4.337" />   

Now try to build and publish your web application to make sure that bundling works.

Liked this post? Empower your friends by sharing it!

View Comments (3)

Related Post