No executable found matching command "dotnet-bundle" during WebDeploy for ASP.NET Core
Asked Answered
D

3

29

I am new to ASP.NET and I am trying to publish a web app. I have tried with 2 different hosts to do a web deploy but keep receving the error:-

No executable found matching command "dotnet-bundle"

What is this related to?

Project.Json

{
"dependencies": {
"Bitly.Net": "0.0.6",
"BitlyAPI": "1.0.3",
"BundlerMinifier.Core": "2.2.281",
"Common.Logging": "3.4.0-Beta2",
"Microsoft.AspNetCore.Diagnostics": "1.0.0",
"Microsoft.AspNetCore.Mvc": "1.0.1",
"Microsoft.AspNetCore.Razor.Tools": {
  "version": "1.0.0-preview2-final",
  "type": "build"
},
"Microsoft.AspNetCore.Routing": "1.0.1",
"Microsoft.AspNetCore.Server.IISIntegration": "1.0.0",
"Microsoft.AspNetCore.Server.Kestrel": "1.0.1",
"Microsoft.AspNetCore.StaticFiles": "1.0.0",
"Microsoft.Extensions.Configuration.EnvironmentVariables": "1.0.0",
"Microsoft.Extensions.Configuration.Json": "1.0.0",
"Microsoft.Extensions.Logging": "1.0.0",
"Microsoft.Extensions.Logging.Console": "1.0.0",
"Microsoft.Extensions.Logging.Debug": "1.0.0",
"Microsoft.Extensions.Options.ConfigurationExtensions": "1.0.0",
"Microsoft.VisualStudio.Web.BrowserLink.Loader": "14.0.0",
"Parse": "1.7.0",
"Spring.Social.Twitter": "2.0.0-M1",
"Stormpath.AspNetCore": "0.7.0"
},

"tools": {
"Microsoft.AspNetCore.Razor.Tools": "1.0.0-preview2-final",
"Microsoft.AspNetCore.Server.IISIntegration.Tools": "1.0.0-preview2-final"
},

"frameworks": {
"net46": {
  "frameworkAssemblies": {
  }
}
},

"buildOptions": {
"emitEntryPoint": true,
"preserveCompilationContext": true
},

"publishOptions": {
"include": [
  "wwwroot",
  "**/*.cshtml",
  "appsettings.json",
  "web.config"
]
},

"scripts": {
"prepublish": [ "bower install", "dotnet bundle" ],
"postpublish": [ "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" ]
},
"userSecretsId": "aspnet-ParseAppDashboard-20161008081***"
}
Dated answered 16/10, 2016 at 7:22 Comment(0)
H
54

In tools section of Project.json add this-

  "tools": {
    "BundlerMinifier.Core": "2.2.281",
    ....

On saving Project.json, VS2015 automatically restore packages.

If it doesn't worked then right click on project and click on Restore Packages option.

If this doesn't worked then try restoring using dotnet restore CLI command.

See if this helps.

Humbert answered 16/10, 2016 at 7:54 Comment(6)
That seems to have removed that issue. Thank you very much @HumbertDated
It helped me too, but I did additional step to fix the Version for package 'BundlerMinifier.Core' could not be resolved. error message, after the No executable found matching command "dotnet-bundle". one disappeared. So, I right clicked on a project and hit the Restore Packages command.Leveridge
@OlegBurov Thank you for sharing your solution. I had the same issue as you did, and after applying your additional step it solved my issue. Hopefully your comment will help others, as well.Saxhorn
Do we have any idea why BundlerMinifier.Core isn't included by default in a new ASP.Net core app? (I suppose in theory I created my app as an ASP.Net Core 1.0 app, and have since upgraded to 1.1. Could that be part of the problem?)Embryology
No @JoelB... I am not sure why BundlerMinifier is not included by default.Humbert
In case of ERROR: "Could not find ... user... \.nuget\packages\.tools" after editing of project.json simply delete project.json.lock file.. Visual Studio will recreate it and missing package will be downloaded.Dorcas
I
31

Since the end of 2016 (RC3 & later, VS2017 & later) move to .csproj file format, add

<DotNetCliToolReference Include="BundlerMinifier.Core" Version="2.6.375" />

to an <ItemGroup>:

<Project ToolsVersion="15.0" Sdk="Microsoft.NET.Sdk.Web">

  ...

  <ItemGroup>
    <DotNetCliToolReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Tools" Version="1.0.0-msbuild3-final" />
    <DotNetCliToolReference Include="BundlerMinifier.Core" Version="2.6.375" />
  </ItemGroup>
</Project>

Or create a new <ItemGroup> (you can have many of them) for your DotNetCliToolReference settings.

But look at https://www.nuget.org/packages/BundlerMinifier.Core for the latest version number

Imbrue answered 7/2, 2017 at 20:53 Comment(4)
This is still not getting me past the same issue as the OP, I'm using core 2.0. (I have set default project to the correct project in PM console window too) - 2.6.375 is still the latest version at time of writing.Hesta
try dotnet restore after manually adding the BundleMinifier? Does dotnet bundle work from a command line in the project directory?Imbrue
How does this apply in a CI environment, you won't open VS there and click on save or something like that?Luhe
@Luhe - say more? This answer doesn't require opening VS, it's a one-time fix to edit the project file and save it.Imbrue
M
2

You probably also need to add

"runtimes": {
"win10-x64": {}
},

to your project.json if you want to upgrate to core 1.1 (also change to correct runtime in the global.json file) I say this because I got the bundle error after upgrading my packages and app to 1.1 in VS2015.

Mohur answered 20/2, 2017 at 10:51 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.