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

霸气de小男生 提交于 2019-12-22 06:29:51

问题


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:

This is the error from output:

Can anyone help me?


回答1:


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.




回答2:


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


来源:https://stackoverflow.com/questions/43655803/the-command-dotnet-bundle-exited-with-code-1-vs-2017-publish-asp-net-core-we

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!