Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BundleTagHelper is not compatible with ASP.NET Core 2.2 (FileVersionProvider no longer exists) #403

Closed
HPurvis opened this issue Feb 4, 2019 · 4 comments

Comments

@HPurvis
Copy link

HPurvis commented Feb 4, 2019

The BundleTagHelper is not compatible with ASP.NET Core 2.2. If the AppendVersion option is enabled, it attempts to create an instance of the FileVersionProvider class. In 2.2, this is now dependency injected as IFileVersionProvider, with the original class no longer existing in that form (see aspnet/Mvc#6371). This causes runtime failures when the tag helper attempts to version the bundles.

To fix the tag helper, it should just be a case of injecting an IFileVersionProvider and using that, however I'm wary of submitting a PR as the change will break compatibility with ASP.NET Core 2.1 and earlier.

For anyone affected by this, a short-term workaround is to turn off the version appending functionality globally. To do this, set up an instance of BundleOptions in your application to be dependency injected into the tag helper so that the default settings are never used, and set AppendVersion to false in that instance (as well as setting the other options appropriately).

@dongdong-yang
Copy link

In my case, it can produce correct bundle files, but after it, it throw incorrect error.

2019-03-03_19-15-51

@dongdong-yang
Copy link

So currently, I install the package, produce bundles, then uninstall it.

rockstardev added a commit to rockstardev/BundlerMinifier that referenced this issue Mar 23, 2019
@rockstardev
Copy link
Collaborator

Solved with 2.9.406, @NicolasDorier is the author of fix.

https://www.nuget.org/packages/BundlerMinifier.TagHelpers/2.9.406

Let me know if you run into any problems with using new version.

@NicolasDorier
Copy link
Contributor

NicolasDorier commented Mar 24, 2019

A better long term solution is to have a package with both .net 2.1 and .net 2.2 versions where the 2.2 just resolve IFileVersionProvider from the ctor.
That said, for some reason, my netcoreapp2.1 is pulling out 2.2 libs... so I don't know what to think.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants