Tools: I Let GitHub Copilot Build My Razor Pages UI (While Rewriting an Old .NET App)

Tools: I Let GitHub Copilot Build My Razor Pages UI (While Rewriting an Old .NET App)

Source: Dev.to

First Attempt: Blazor ## Architecture Before UI ## Prompting Copilot ## What Copilot Generated ## Iterating with AI ## Key Takeaway ## Full Video Walkthrough I'm currently rewriting an old .NET Framework application using modern .NET and AI tools. In this part of the project, I experimented with letting GitHub Copilot inside Microsoft Visual Studio generate the entire user interface. The result was surprisingly good — with a few interesting lessons. My first thought was to use Blazor, since it’s one of the modern front-end options in ASP.NET Core. But after trying several quick experiments, Copilot consistently struggled to generate working Blazor projects. For now, Razor Pages turned out to be far easier for AI-assisted development. Before generating any UI, the application was already organized into separate projects: This keeps the UI layer thin, which is ideal when working with AI tools. The UI project simply references the Services layer, while the rest of the logic lives outside the frontend. This structure works well for small, medium, and even larger projects. To make things easier for Copilot: Interestingly, I did not describe UI controls in detail. I didn’t specify things like: Instead, I described what data should appear and how it should be ordered on the screen. The solution compiled immediately, and the generated PlayLottery page worked. The form allowed users to: The results page showed: From there, the workflow became simple: Prompt → run → refine. For example, I asked Copilot to: Each change required only a small prompt. This makes UI iteration surprisingly fast. For this workflow, Razor Pages works extremely well with AI coding tools. Blazor may still catch up, but right now Razor Pages feels much easier for AI-assisted scaffolding. I recorded the entire process here: 👉 https://www.youtube.com/watch?v=sQdByQML_w8&list=PLphsQTGN5DbKsbob0eN5y4zQhZXUzpow2 💡 If you're experimenting with AI-assisted development in .NET, I'd be curious to know: Have you had better results with Razor Pages or Blazor when using Copilot? Templates let you quickly answer FAQs or store snippets for re-use. Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink. Hide child comments as well For further actions, you may consider blocking this person and/or reporting abuse - Domain – business logic - Data Access – persistence - Services – application layer - Composition Root – dependency wiring - I created a Razor Pages project shell manually - I wrote a high-level prompt describing the page - I focused on DTOs and data layout - specific HTML controls - Razor pages - Page models - choose how many tickets to generate - select number generation strategies - use historical lottery numbers as results - overall results - net profit or loss - display the winning numbers - show the generated tickets - add borders so the results look like actual lottery tickets - keep business logic outside the UI - provide clear DTOs - describe data layout instead of UI controls - iterate with prompts - the prompt used for Copilot - the generated Razor Pages - running the application - refining the UI with additional prompts