关于更新Hangfire Dashboard的jQuery依赖:需创建PR还是可通过已装NuGet包操作?
Great question! Let’s break this down based on your end goal:
If you only need the updated jQuery for your own project
You absolutely don’t need to tweak Hangfire’s source code or submit a Pull Request—you can override the default jQuery reference directly in your project’s configuration. Hangfire Dashboard is built to let you customize its loaded resources easily.
Here’s a straightforward approach:
- When setting up the Hangfire Dashboard in your startup code, use the
DashboardOptionsto replace the default jQuery script with your desired version. Just remember to include Hangfire’s core JavaScript file after your custom jQuery, otherwise the Dashboard’s core functionality will break.
Example code snippet:
app.UseHangfireDashboard("/hangfire", new DashboardOptions { JavaScript = new[] { // Replace with your target jQuery version (local path example) "/js/jquery-3.7.1.min.js", // Keep Hangfire's core JS to maintain dashboard functionality "/hangfire/js/hangfire.js" } });
This workaround lets you use the updated jQuery immediately in your own instance without touching the official NuGet package at all.
If you want Hangfire’s official NuGet package to include the updated jQuery
In this case, you’ll need to create a Pull Request to the official Hangfire repository. The NuGet package’s bundled resources (including the default jQuery) are defined directly in Hangfire’s source code. To push this update for all users, you’ll need to:
- Fork the official Hangfire repository
- Update the jQuery reference in the Dashboard’s resource configuration files
- Submit a Pull Request with your changes for the project maintainers to review and merge
Once merged, the next official NuGet release will ship with the updated jQuery version included.
内容的提问来源于stack exchange,提问作者Willian Andrade

