Blazor Intellisense in .razor file stops working after publishing

Viewed 167

I have a Blazor application using Visual Studio 2019 version 16.10.4. Every time I publish to an IIS server using the Publish... command from the Solution Explorer, Intellisense stops working in the .razor file that I have open and all text coloring goes away, so that all the text becomes the same color (and all auto-indentation stops working). If I close the .razor file and reopen it, Intellisense and colors start working again.

Is that a known issue, or is it a problem that I can fix? I've seen other posts about Intellisense not working in Blazor, but those all seem to be older posts with older minor version numbers of Visual Studio, and they don't mention the problem occurring only when publishing.

2 Answers

This kind of thing happens all the time. The solution is to jiggle it a little bit: close and re-open the file, restart VS, delete bin files, etc. etc.

In Blazor, there are a couple other common culprits. EventCallback with a declared Type often complains that it can't covert the type, even though if you ignore it, it will still compile and run.

Related