BundlerMinifier
BundlerMinifier copied to clipboard
Does not run on Build solution
Installed product versions
- Visual Studio: 2022 Professional (17.9.4)
- This extension: 2.9.9
Description
When enabling "Enabling bundle on build" the Nuget Package is added to the project, but the build does not trigger the bundle process.
Steps to recreate
- Create a new .Net 4.8 solution
- Add two javascript files
- Select them in the solution explorer and let them bundle
- Enable "Enabling bundle on build" by right clicking the buncleconfig.json file.
- Delete the bundle output files.
- Build the solution
Current behavior
There is no bundle.js
file and no minified file.
Expected behavior
A newly generated bundle.js
and bundle.min.js
file.
I just stumbled across this issue myself. It looks like "Enable bundle on build" added the appropriate NuGet package but didn't change csproj to actually do the bundling. I was able to get it working by adding the same stuff that the WebCompiler adds when you enable the compile on build functionality there.
First, inside of the EnsureNuGetPackageBuildImports target:
<Error Condition="!Exists('..\packages\BuildBundlerMinifier2022.2.9.9\build\BuildBundlerMinifier.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\BuildBundlerMinifier2022.2.9.9\build\BuildBundlerMinifier.targets'))" />
And then just below that alongside a few other imports:
<Import Project="..\packages\BuildBundlerMinifier2022.2.9.9\build\BuildBundlerMinifier.targets" Condition="Exists('..\packages\BuildBundlerMinifier2022.2.9.9\build\BuildBundlerMinifier.targets')" />
I didn't see any errors in Visual Studio to indicate why these lines didn't get added.
~~Interesting. I'm currently get an exception trying to find the bundle NuGet..~~
I'm seeing the same thing, now that I properly re-added nuget.org to package sources in the VS NuGet Package Manager Options page. (using PackageReference for so long now I've forgotten how to use packages.config)
@failwyn I've submitted a PR for this as well as one that enables dotnet tool support in the package.
Hopefully you'll have time to review and could get merged/published so I could make use of this in our processes in the near term.
Hello, just curious if this has been published... I seem to still be having this issue in my Visual Studio.
We’re testing it in my company and will publish Friday if all looks good; I can upload a debug version here if you want to help test before I publish it; the only issue with the debug version is that you won’t be able to use Minify On Build since I haven’t published the new NuGet package yet.