29 03 2017
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.