Syntax highlighting stopped working in Blazor Server project - visual-studio-2019

I am using Visual Studio 2019 16.8.1 and the project targets NET 5.0.
The whole code section is highlighted. Is this normal?

I just re-opened the file/re-opened Visual Studio. #Brian Yes there was ambiguity but i think a broken build somewhere

Related

Visual Studio for Mac 2022 - Hot Reload?

I am a fairly new to developing applications on Mac OS. I am using Visual Studio for Mac 2022 - Preview. I am all up to date and have created a ASP.NET MVC Web Application using .NET 6. I have started the debugger using the generated project. I make a change to the Index.cshtml file but that change fails to be reflected in the browser after saving the file. Any ideas if Hot Reload works in Visual Studio for Mac? I dont see any button to toggle the Hot Reload as all screenshots i have seen are for Windows Visual Studio. Any help would be appreciated as stopping and starting the debugger each time a change is made is very inconvenient. Thanks.
EDIT:
I have installed the Nuget Package
Microsoft.AspNetCore.Mvc.Razor.RuntimeCompilation
And then updated my Program.cs file as follows:
// Add services to the container.
builder.Services.AddControllersWithViews().AddRazorRuntimeCompilation();
My changes to .cshtml files still do not want to recompile after saving.
Any more help would be appreciated.
Visual Studio for Mac
Version: 17.0 Preview (17.0 build 5186)
Created a new Web Application (Model-View-Controller) project.
I got it to work on the latest preview version of Visual Studio 2022 for Mac. You will need to add the NuGet package, and also add the service to your builder in the program.cs file as an extra service:
builder.services.AddRazorPages().AddRazorRuntimecompilation();
https://learn.microsoft.com/en-us/aspnet/core/mvc/views/view-compilation?view=aspnetcore-6.0&tabs=visual-studio#enable-runtime-compilation-for-all-environments
I don't know of any way to do it within Visual Studio, but if you navigate to the folder with your .csproj in Terminal, you can type
dotnet watch
and it will load your app. Then you can make changes within Visual Studio, save, and the browser will automatically reload. The only problem is since it's running from the command line, it won't hit breakpoints in your program (I don't know of any way to do so anyway).
As mentioned above, adding builder.Services.AddRazorPages().AddRazorRuntimeCompilation() works well, the only thing that you have to reload the page manually though, while your project is running.

Microsoft Visual Studio Community 2019 CodeLens reference counter incorrect

I have a Windows Forms App with .Net Framework 4.8 and suddenly I realized that only a vertical line appears instead of the reference counter. Any idea how to fix it?
This applies to most of my solutions,but not all. I also noticed that if I reinstall Visual Studio it works after the first start, but once I close it and open it again the error comes back.
"C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE>devenv /resetuserdata" solved my problem.

Visual Studio 2015 crashes when opening angle bracket

as soon as I open an angle bracket in a cshtml file, Visual Studio crashes.
I deleted the .suo file but no change. I also deactivated every editor related add-in.
turned out that the asp.net and web tools beta 7 caused the problem. I also had problems loading projects what took me to this answer.
Installing english langugage pack and switching VS to english helped me.

"This project is incompatible..." after VS 2013 Update 4

After installing Update 4 for VS 2013, I immediately started getting the message
This project is incompatible with the current version of Visual Studio
when I try to open all my MVC projects.
I've tried following advice on older posts, such as changing the version of visual studio, and checking for other updates, but none have worked.
I am using Visual Studio Premium 2013 and have .Net 4.5. It happens to projects that target both 4.0 and 4.5.
This is happening with MVC projects, but it does not happen when opening a simple project containing only .cs files.
Repairing Visual Studio turned out to be the solution.
I believe the initial update was unsuccessful because the C drive was low on space. Clearing up space, and repairing both .Net 4.5.1 and Visual Studio did the trick.

Why is editing Umbraco templates in Visual Studio slow?

I've created an Umbraco 7.1.8 in Visual Studio 2013 using MVC templates. When I edit the templates in Visual Studio the editor slows right down and VS shows a permanent 13% usage in Task Manager. If it helps, I'm using Windows 8.1 64-bit on a machine with a 2.3GHz quad-core cpu. Other projects work fine.
Any help/suggestions would be appreciated.
Jason
Okay, found out what the problem was. It turns out if you don't include the .cshtml file in your Visual Studio project (just edit it with Show All Files enabled), you don't get Intellisense and it results in the CPU usage and performance issue I described.
So basically, if you're editing files in Visual Studio, make sure they're included in the project (not greyed out in the Solution Explorer). I'll accept this as the answer as soon as it lets me.

Resources