madskristensen / BundlerMinifier

Visual Studio extension
Other
616 stars 173 forks source link

BundleMinifier is not called for dotnet publish #302

Open KhalipskiSiarhei opened 7 years ago

KhalipskiSiarhei commented 7 years ago

Installed product versions

Description

BundleMinifier is not called for dotnet publish. As a result in publish package there are not created bundles according to configuration in bundleconfig.json.

Steps to recreate

  1. Configure any JS bundle
  2. Specify BundleMinifier to be run after build
  3. Run dotnet publish

Current behavior

In the publish package in wwwroot folder there are not created bundles. But if we build project in VS bundles do exist. It means that BundleMinifier is not called for dotnet publish

Expected behavior

Bundles should be generated for dotnet publish command as well and it should be allowed to configure binding (After Build, Before Build) for publish workflow.

joergjo commented 7 years ago

Make sure to include

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

in your .csproj file.

diegohb commented 7 years ago

bundle doesn't seem to be a valid command.. tried it at sln and csproj

PS E:\dev\projects\pscm_wkspaces\array\Array.Pivotal.Frontend\src> cd .\Pivotal.Frontend.WebUI\ PS E:\dev\projects\pscm_wkspaces\array\Array.Pivotal.Frontend\src\Pivotal.Frontend.WebUI> dotnet bundle No executable found matching command "dotnet-bundle" PS E:\dev\projects\pscm_wkspaces\array\Array.Pivotal.Frontend\src\Pivotal.Frontend.WebUI>

scottaddie commented 6 years ago

@diegohb The "bundle" command is registered when you add the appropriate <DotNetCliToolReference /> element to your *.csproj file. See the following doc for more info: https://docs.microsoft.com/aspnet/core/client-side/bundling-and-minification#ad-hoc-execution-of-bundling-and-minification