In ASP.NET vNext, why is the code not recompiled on the fly?

I am running the HelloMvc example application from the command line using k web. I tried to run it using various environments available to me using kvm use -runtime. When I change the controller and press F5 (or Ctrl + F5) in the browser, the code does not recompile automatically and the page does not change. What am I doing wrong?

Active Version Runtime Architecture ------ ------- ------- ------------ 1.0.0-alpha3 svr50 x86 1.0.0-alpha3 svrc50 x86 1.0.0-alpha4 CLR x86 * 1.0.0-alpha4 CoreCLR x86 
+6
source share
2 answers

Running dnx web from the command line starts your host. To qualify for automatic recompilation, you need to look at the files for changes and restart the host if any changes are found. To do this, use the --watch flag and run your web command as follows:

 dnx --watch web 

Currently, it just shuts down your host when a change is detected, so you need something that reloads it as soon as this happens. IISExpress does this for you if you are running a project from Visual Studio 14.

Your best bet for this workflow outside of Visual Studio is the JavaScript build tool or npm scripts. I would recommend you study this gulp -aspnet-k plugin (note that this plugin only works with windows at the moment) if you want continuous recompilation when changing a file while working outside of VS14. This seems to be the best way to achieve this without IISExpress, which I found. This plugin has / was Windows specific, but when viewing the code you need to get started. :)

Glen F. Henriksen wrote a wrapper for nodemon, which is very nice, called kmon. Try it too. The kmon GitHub repository has all the necessary instructions.
+16
source

Based on the gulp plugin associated with AndersNS , there are few features that you can use to automatically restart the application:

 @powershell -NoProfile -ExecutionPolicy unrestricted -Command "for(;;) { Write-Output \"Starting...\"; k --watch web }" 

If you paste this into a batch file (for example, run.cmd ), you can easily launch the application, save it and automatically restart and rebuild when the file changes.

Make sure you edit the k command line if you want to use a different target than the web .

+3
source

Source: https://habr.com/ru/post/976774/


All Articles