drw 1.0.0
dotnet tool install --global drw --version 1.0.0
dotnet new tool-manifest # if you are setting up this repo dotnet tool install --local drw --version 1.0.0
#tool dotnet:?package=drw&version=1.0.0
nuke :add-package drw --version 1.0.0
dotnet-remote-watch
Turns dotnet watch
into a client-server model, so that the server (watcher) and the client (App) do not have to be run in the same host.
The primary intended use case is to run dotnet watch
inside a dev container, and have the client run on the host, which does not necessarily have the .NET SDK/runtime installed. Hot-reloading Windows desktop apps (e.g., WPF, WinUI) with dev containers is now possible.
With some custom port forwarding, it should be possible to hot-reload an application on a remote machine or container.
Installation
dotnet tool install --global drw
Usage
Add the following section to project file:
<Import Project="$(RemoteWatchTargets)" Condition="'$(RemoteWatchTargets)' != ''" />
Launch server:
dotnet remote-watch
remote-watch
is supposed to be used in the same way asdotnet watch
and it will launch and forward all arguments todotnet watch
after initialization.Launch
HotReload.Client
generated in the output directory. It will launch the target App after connecting toremote-watch
.Update source code and observe the changes.
Environment variables
DOTNET_HOTRELOAD_PORT
: The port to use for the client-server communication, default is 3000.
MSBuild
Consider setting the following MSBuild properties in the project file or environment variables:
SelfContained
: Set to true so that the client can run on an environment without the .NET SDK/runtime installed.RuntimeIdentifier
: Set the target runtime identifier if it's different from where the watcher runs.
How it works
remote-watch
intercepts the named pipe connection between dotnet-watch
and Microsoft.Extensions.DotNetDeltaApplier.dll
(injected into the target application via StartupHooks). The server forwards the intercepted data to HotReload.Client
through a TCP connection (tcp://localhost:$DOTNET_HOTRELOAD_PORT
), and HotReload.Client
forwards the data to the target application through another named pipe.
Note that the internal implementation of dotnet-watch
may change in the future.
dotnet watch
dotnet remote-watch
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net8.0 is compatible. 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. |
This package has no dependencies.