Search code examples
visual-studioblazorcode-behind.net-8.0

Extract block to code behind is no longer available in .NET 8 and Visual Studio 2022


I'm using .NET 8 and Blazor in Visual Studio 2022 and I want to move my C# code to a code behind file. There is supposed to be an option called "Extract block to code behind" if you highlight the code block in the .razor page, I've watched a tutorial on this but I don't have that option in my editor.

Has this been removed from .NET 8 or am I missing a setting of some sort?

It seems to be a general issue with the QuickActions menu, it doesn't appear if I press Ctrl+. or right click on the menu options


Solution

  • It works OK over here, VS 17.9.3.

    Do not "highlight the code block" but just place your cursor in the @code word and then press Ctrl+.