How to enable roslyn auto build in my vnext application

I made a demo application to test all the new asp vNext and Roslyn features, but I can’t reproduce what I saw in the presentations: edit the contents of the viewbag of the controller and refresh the page to see the new bag, why?

  • I created a vNext project with VS 2015 on my bootcamp (Windows10),
  • Select the starter web project (using controllers and some types),
  • Run the project (start, play button),
  • go to the view and view the contents,
  • then edit the viewbagin of the controller and SAVE the controller,
  • press F5 in the browser, and the content is still the same, why?

Roslyn has to "rebuild" the controller, and then if I press f5, I need to see the new content, right? Is it possible to activate this feature?

I am sure that this is the viewbag used for presentation, because when I stop and restart the project, everything is fine.

Maybe because roslyn is not selected as the compiler, but vNext needs roslyn to run sooo. I'm worried about: -)

here is the controller i edited:

public IActionResult About() { ViewBag.Message = "Your application description page. coooooool"; return View(); } 

and corresponding view:

 @{ ViewBag.Title = "About"; } <h2>@ViewBag.Title.</h2> <h3>@ViewBag.Message</h3> <p>Use this area to provide additional information.</p> 

I am sure this is roslyn, because I can put this code in the application without problems:

 string s = nameof(Console.Write); 

This is the KVM configuration:

 C:\Program Files (x86)\Microsoft Visual Studio 14.0>kvm list Active Version Runtime Architecture Location Alias ------ ------- ------- ------------ -------- ----- 1.0.0-beta1 CLR amd64 C:\Users\clement\.kre\packages 1.0.0-beta1 CLR x86 C:\Users\clement\.kre\packages 1.0.0-beta1 CoreCLR amd64 C:\Users\clement\.kre\packages 1.0.0-beta1 CoreCLR x86 C:\Users\clement\.kre\packages * 1.0.0-beta2 CoreCLR x86 C:\Users\clement\.kre\packages default 

Thanks in advance for your help!

+5
source share
2 answers

Use start without debugging option (ctrl + F5)

+4
source

According to my experience with this feature, this will not work in debug mode. You can do the following.

  • Launch the site on a specific port.

  • Edit controller and save

  • Refresh the page and it will work.

Note. I tested this in VS 2015 CTP 5.

+1
source

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


All Articles