From the course: Creating .NET MAUI Applications with Blazor

Unlock the full course today

Join today to access over 24,900 courses taught by industry experts.

Razor Class Libraries

Razor Class Libraries

- [Instructor] We've explored one way to handle differences in platform APIs using a .NET 7.0 DLL that we can also use to share business logic. But how about the Razor pages themselves? Can those be shared? The answer is yes with the Razor Class Library. This is a special container for sharing Razor files. To create one, we're going to start by right clicking on our solution and going in and clicking Add, New Project. And we'll search for the word Razor and we want Razor Class Library. And we'll press next and we're going to name it Notes.Library. And press next and we'll select .NET 7.0, which is what we've selected for the other projects and press Create. Now, there's some boilerplate code that we don't need in this library, so I'm going to remove it. So this Component1.razor, we'll delete it. And also under wwroot or wwwroot, there's example.JsInterop, and we'll delete that as well. We also want to make sure that both…

Contents