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
- Make sure you have Nodejs installed on your machine
- Make sure you have bower package installed on your machine
- 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.
- Add reference to BundleMinifier.Core and BuildBundlerMinifier NuGet packages.
- Open project files in editor
- Make sure you have DotNetCliToolReference to bundle minifier:
<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.
3 thoughts on “Solving bower and bundling errors in imported ASP.NET Core projects”
Thanks, you save my life.
Wow, thank you very much! That really helped to get closer to my problem.
Another last piece I was able to find here, where it says, that after that, you have to go into the csproj file and set the version of the BundlerMinifier.Core DotNetCliToolReference (2.2.x) to the same one as the DotNetCliToolReference (3.2.449 in my case).