Not linked directly to Hot Reload, but I've been trying to find a way to speed up the build-run process. This assumes that you make changes only in the code of the Plugin project:
1. Run the `Nop.Web` project from command line as
dotnet watch run --no-build
This means that it will only run the project, without building it every time. It starts in about 5 seconds, which is ok.
2. Update the *.csproj of your Plugin project
Add this line into the `AfterTargets="Build"` section.
<!-- Trigger Nop.Web reload -->
<Exec Command="powershell (ls '..\..\..\..\src\Presentation\Nop.Web\Controllers\HomeController.cs').LastWriteTime = Get-Date" />
My project is in a separate folder, not `src\Plugins`, so the relative path might need to be adjusted slightly.
What this does is that after the plugin finishes building, it will trigger a change in the Nop.Web project, which will restart the application and will load in the latest changes from the Plugin. It should look like this:
<!-- This target execute after "Build" target -->
<Target Name="NopTarget" AfterTargets="Build">
<!-- Delete unnecessary libraries from plugins path -->
<MSBuild Projects="@(ClearPluginAssemblies)" Properties="PluginPath=$(MSBuildProjectDirectory)\$(OutDir)" Targets="NopClear" />
<!-- Trigger Nop.Web reload -->
<Exec Command="powershell (ls '..\..\..\..\src\Presentation\Nop.Web\Controllers\HomeController.cs').LastWriteTime = Get-Date" />
</Target>
3. Watch & build the Plugin project from the command line:
dotnet watch build /p:BuildProjectReferences=false
This will only trigger a build for the Plugin, and it will ignore other project references like Nop.Web or Nop.Web.Framework
---
If you save any file in the Plugin project, it will rebuild the plugin automatically and will also trigger a restart for Nop.Web.
4. If you want to enter Debug mode, attach the debugger from Visual Studio to the `Nop.Web.exe` process. No need to start a different debug session or rebuild.