XML documentation comments serve two purposes: Intellisense shows the comments to devs using your code. You can generate a documentation file and include it in your build and nuget package. In this article I’ll show how to automatically generate an XML documentation file and how to include it in a nuget package. 1 – Write … Read more
If you’re using the built-in MSTest unit testing framework, you may be used to the old way of asserting exceptions by using the [ExpectedException] attribute. The following example illustrates one of the key problems with this approach: The ArgumentNullException is being thrown, so the test passes. However, the exception is being thrown in the arrange … Read more
When you create a new project in Visual Studio the default directory is C:\Users\<userName>\Source\Repos. This article shows you how to change that. Steps Open Visual Studio. Click Tools > Options… Change the Projects location. Results Now when you create a project it’ll default to this location.
Problem The Class Diagram item is missing in Visual Studio 2019. Solution For some reason this is not installed by default in Visual Studio 2019, so we simply need to install it. 1. In Visual Studio click Tools > Get Tools and Features… 2. Close Visual Studio. 3. In Visual Studio Installer: Click Individual components … Read more
Problem I have a unit test project in Visual Studio 2019. When I click Run All Tests, none of the tests run. I looked in the Tests output window and saw a message that says: Test project does not reference any .NET NuGet Adapter. Test discovery or execution might not work for this project. It’s … Read more
Problem When I open a C# project in Visual Studio 2019, none of the references are loading. In the error list it says: The referenced component could not be found This usually means you need to restore the Nuget Package. In this case, it’s even showing this for .NET Framework references – such as System.Core. … Read more
You need to auto-increment your build numbers in order to easily tell which code you’re working with. In this article I’ll explain how to auto-increment your build numbers in Visual Studio. I’ll be using text templating to generate the Assembly Version. Update (2021-3-27): I added information about how to handle this .NET Core projects. 1 … Read more
Problem You’re trying to debug a program with Visual Studio but Attach to Process does not work. Most likely you’re loading your code through some third-party process (like Excel), and when you try to use Attach to Process it simply doesn’t work. Solution Instead of trying to use Attach to Process, you can launch a … Read more