Using Code Cleanup Profiles in Visual Studio

In Visual Studio 2022, the Code Cleanup Profiles feature is a great way to automate code formatting and clean-up operations using predefined or custom rules. By using cleanup profiles, you can make all of the changes in one operation and free yourself from updating lots of code files manually. Here's a detailed explanation of how … Continue reading Using Code Cleanup Profiles in Visual Studio

How to Make Internal Types Visible to Other Projects Using .csproj File

In many software development scenarios, especially when working with unit tests, you might encounter situations where you need to test internal types and methods within your code. However, internal members are, by default, inaccessible to other projects. The traditional approach to solving this problem in .NET is to make these internal types visible to specific … Continue reading How to Make Internal Types Visible to Other Projects Using .csproj File

Endpoint Explorer in Visual Studio

(Version: Visual Studio 17.6+) HTTP files are a popular feature in VSCode and were brought into Visual Studio too. Recently, I learned about another cool endpoints feature in Visual Studio called the Endpoints Explorer. This tool window lists all of the endpoints of your Web API project. You can find the Endpoints Explorer by going … Continue reading Endpoint Explorer in Visual Studio

Configure Visual Studio to Use File-Scoped Namespaces on New Classes

Filed-scoped namespaces were a new feature added to C# 10. File-scoped namespaces simplify the organization of code by allowing you to declare the namespace at the file level rather than wrapping each type in its own namespace block. This can lead to more readable and concise code with one less layer of curly braces in … Continue reading Configure Visual Studio to Use File-Scoped Namespaces on New Classes

GitHub Enterprise included with Visual Studio Subscription

I learned today that the GitHub Enterprise license is included with your Visual Studio Subscription (previously MSDN subscription). This means that you can use the Enterprise features of GitHub when you tie your VS Subscription with it. Great news for people with that subscription, so you don't have to pay for both. Here is a … Continue reading GitHub Enterprise included with Visual Studio Subscription

How-To: Use Class File for Blazor Logic Code

As our logic continues to grow and our testing requirements increase, we will find that it is more efficient to separate our application logic from the rendering logic on pages. This split helps us separate these concerns and build cleaner pages. Also, having the logic within a separate C# class allows us to unit test … Continue reading How-To: Use Class File for Blazor Logic Code

How-To: Use Blazor Code-Behind File

In Blazor, sometimes our page code becomes large and cumbersome. Rather than keep all of the HTML markup and C# code in the same .razor file, we can split our markup and code into separate files. Blazor supports creating code-behind files for the .razor file (similar to other .NET technologies like WinForms, ASP.NET, WPF, etc). … Continue reading How-To: Use Blazor Code-Behind File

How-To: Write bUnit Test for Component

bUnit is a testing library for Blazor components. Its goal is to make it easy to write comprehensive, stable unit tests for components. We will learn the steps to create a bUnit test class from setup to rendering to validation. This test will focus on testing a static component with a simple rendering operation. First, we must have a … Continue reading How-To: Write bUnit Test for Component