Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

The command "dotnet bundle" exited with code 1 - VS 2017 Publish ASP.NET Core Web API

I'm getting the following error when trying to publish my Web API to a server:

The command "dotnet bundle" exited with code 1

This is the publish screen: enter image description here

This is the error from output:

enter image description here

Can anyone help me?

like image 476
perozzo Avatar asked Apr 27 '17 10:04

perozzo


2 Answers

Make sure you have added the DotNetCliToolReference in your WebApi project. I'm assuming VS2017 csproj file.

  <ItemGroup>
    <DotNetCliToolReference Include="Microsoft.EntityFrameworkCore.Tools.DotNet" Version="1.0.0" />
    <DotNetCliToolReference Include="BundlerMinifier.Core" Version="2.2.281" />
  </ItemGroup>

The second entry in the code above.

like image 58
Allan Nielsen Avatar answered Nov 18 '22 11:11

Allan Nielsen


Method 01

Find your .csproj file and right_click > Edit or right click on you project go to 'Edit projectnam.csproj'

Then comment or remove

  <Target Name="PrepublishScript" BeforeTargets="PrepareForPublish">
    <Exec Command="bower install" />
    <Exec Command="dotnet bundle" />
</Target>

Method 02

You need install NodeJS globally. then run

npm install -g bower 

and

npm install -g gulp
like image 37
isanka thalagala Avatar answered Nov 18 '22 12:11

isanka thalagala