EasyHotReload 1.0.0
dotnet add package EasyHotReload --version 1.0.0
NuGet\Install-Package EasyHotReload -Version 1.0.0
<PackageReference Include="EasyHotReload" Version="1.0.0" />
paket add EasyHotReload --version 1.0.0
#r "nuget: EasyHotReload, 1.0.0"
// Install EasyHotReload as a Cake Addin #addin nuget:?package=EasyHotReload&version=1.0.0 // Install EasyHotReload as a Cake Tool #tool nuget:?package=EasyHotReload&version=1.0.0
EasyHotReload
A .NET package that lets you easily register for Hot Reload events.
Works with dotnet watch
and JetBrains Rider in addition to other environments that support hot reload.
Usage
First, define a class that implements IHotReloadable
:
public class ExampleHotReloadableImplementation : IHotReloadable, IDisposable
{
private int Value { get; set; } = 1;
// This function will be called whenever a hot reload is triggered.
public void ProcessHotReload()
{
Console.WriteLine($"{this.GetType().Name} has been hot reloaded {Value++} times");
}
// Here, we use a disposal method to unregister the object to avoid null reference problems.
public void Dispose()
{
HotReloadRegistry.UnregisterReloadable(this);
GC.SuppressFinalize(this);
}
}
Then, initialize the object and register it:
using ExampleHotReloadableImplementation reloadableImplementation = new();
// Add this object to the registry so that EasyHotReload knows to call the function.
// You can also just do this in the constructor - this call is here to demonstrate that it's necessary.
// It's also good practice to UnregisterReloadable to avoid null reference problems. This is done in the implementation via IDisposable.
HotReloadRegistry.RegisterReloadable(reloadableImplementation);
The registry is thread-safe, so don't worry about calling from multiple threads. Just beware that hot reload events can come through any of the ThreadPool worker threads.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net7.0 is compatible. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
-
net7.0
- No dependencies.
NuGet packages (1)
Showing the top 1 NuGet packages that depend on EasyHotReload:
Package | Downloads |
---|---|
Bunkum
An open-source protocol-agnostic request server for custom game servers, built with flexibility yet ease of use in mind. |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
1.0.0 | 7,195 | 9/25/2023 |