.NET Core SDK Upgrade

I have been experimenting with .NET Core for a while now and I have also been trying to keep my .NET Core SDK versions up to date. I noticed though there is not much direction from Microsoft about how to upgrade the SDK version. I could not see any information about whether one should uninstall the previous version or overwrite the existing with the new SDK. So I am posting my findings around updating the .NET Core SDK.

Read more of this post

Checking compatibility with .NET Portability Analyzer

This article is also available on the Microsoft TechNet Wiki.

With multiple project types now available in Visual Studio, it can sometimes get confusing which flavours of .NET work with which frameworks. This can now be compounded with .NET Core. Thus, creating code that is reusable means you need to take all factors into consideration so you can get maximum portability. Luckily, there is a tool that can help you port your .NET projects.

The Microsoft .NET Portability Analyzer is a free Visual Studio Add-in that offers a detailed report on the flexibility of your code. The report gives you an idea of how much work you need to do to make your application, library or project workable on other platforms, including .NET Core.

In this article, we will see how to install, set up and run the tool so we can see the detailed report it generates.

Read more of this post

Create GUID Tool in Visual Studio

This article is also available on the Microsoft TechNet Wiki.

A globally unique identifier or GUID is an id that is exclusive throughout the globe. They are usually 128 bits long and are shown in hexadecimal groups separated by hyphens.

Within Visual Studio there exists a standalone tool (guidgen.exe) that allows developers to create GUIDs in a specific format. Creating GUIDs in code is easy enough but perhaps you need to generate one (for a constant or while unit testing) without running your code. This tool can help with that.

Creating GUIDs

  1. To find the tool, open Visual Studio and click Tools > Create GUID.GUID_01
  2. The Create GUID window will appear.
  3. There are seven different GUID formats to choose from. As you move through the types, the Result window will display what the GUID value will look like.
  4. If you want a different GUID, click the New GUID button.
  5. Once you are happy with your result, click the Copy button to save it to the Clipboard. You can then paste it to your desired locale.
  6. Click Exit to close the dialog window.


If the tool does not appear under the Tools menu, click Tools > External Tools (see top image). It may be that the tool was not registered correctly within the IDE. Using the External Tools window, we can add a reference to guidgen.exe.

  1. Click the Add button. A new tool will be added to the Menu contents.
  2. Fill in the fields like so:
    • Enter a Title of Create &GUID. The ampersand will create a hotkey using the letter G.
    • For the Command field, browse to the Tools folder of your current Visual Studio install and find guidgen.exe. This location will typically be %Installation Path%\Microsoft Visual Studio {Version Number}\Common7\Tools\guidgen.exe. For Visual Studio 2015, the full path will look like this: C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\Tools. NOTE: You can also double click the exe here to run it. You will see the same Create GUID UI as above.
    • For the Initial directory, use the guidgen.exe root folder or %Installation Path%\Microsoft Visual Studio {Version Number}\Common7\Tools\
  3. When you are done, your entry should look something like this:GUID_03
  4. Click OK.
  5. Your tool should now appear in the Tools menu.

See Also

Using the Obsolete Attribute in C#

This article is also available on the Microsoft TechNet Wiki.

The Obsolete Attribute marks elements like classes, methods, properties, fields, delegates, and many others within your code as deprecated or obsolete.The attribute is read at compile time and it is used to generate a warning or an error to the developer.

This attribute can help you if you have ever wanted to make sure programmers use newer versions of your methods. It also makes it easier when you are transitioning from older methods to newer ones. Marking an item as obsolete warns users that program elements will be removed in future versions of the code base.

Obsolete Attribute

The attribute is found in the System namespace. The Obsolete attribute decorates a program element by putting the word “Obsolete” above it inside square brackets. Since it is an attribute, you can use either Obsolete or ObsoleteAttribute.

You can use it without arguments and in which case it generates a generic compile-time warning. It can also take one or two optional parameters: Message and IsError.

The Message parameter is a string value with the deprecation message. The message should state that the program element is obsolete and, if possible, point them to the new element to be used.

The IsError parameter is a Boolean value that tells the compiler whether to generate an error or not. An error is generated when IsError is true. If it is set to false, or is not included, then only a warning is generated.

Code Sample

The following code sample shows how to decorate methods with the Obsolete attribute:

using System;

class Program
        // Mark Method1 obsolete without a message.
        public static string Method1()
            return "You have called Method1.";

        // Mark Method2 obsolete with a warning message.
        [ObsoleteAttribute("This method will soon be deprecated. Use MethodNew instead.")]
        public static string Method2()
            return "You have called Method2.";

        // Mark Method3 obsolete with an error message.
        [ObsoleteAttribute("This method has been deprecated. Use MethodNew instead.", true)]
        public static string Method3()
            return "You have called Method3.";

        public static string MethodNew()
            return "You have called MethodNew.";

        public static void Main()

The messages generated in the Error List appear as:

Error List

The two warnings are shown, as is the requested error.


CloudDevelop and DetroitDevDay Wrap-Ups

Over the past month I have spoken at two conferences in the United States. While I have presented talks there before, it seemed that fate wanted me in the United States twice within a one-month span.

The first place I presented was Cloud Develop 2015 in Columbus, OH on Friday October 23, 2015. This conference targets developers who work with the cloud and who want to know more about it. I presented my talk on Building High-Performance Software with Application Insights to a room of about 30 people. There were about two hundred attendees and the conference organizers actually sold all of their available tickets. Run by Michael S. Collier and his team, the one-day event was held in the Ohio Union on the beautiful campus of Ohio State University.

WP_20151023_001    WP_20151023_002

The second talk was at DetroitDevDay in Detroit, MI on Saturday November 14, 2015. This one is more of a polyglot conference where computer professionals of all backgrounds can come and learn about all types of technologies. I presented the talk Analyze Your Code With Visual Studio 2015 Diagnostic Tools to about 40 people. There were about 150 attendees at this one-day conference. It is run by Onorio Catenacci and his team of dedicated volunteers. The venue for the event was Cobo Hall in downtown Detroit and it was spectacular. It had amazing views of the Detroit River and nearby Windsor, ON.


The slide decks for both talks are on my SlideShare profile.

Related Articles

Understanding the Visual Studio AssemblyInfo Class

This article is also available on the Microsoft TechNet Wiki.

This article won a silver medal in The Microsoft TechNet Guru Awards! (September 2015).


The AssemblyInfo Class holds application attributes about a Visual Studio project that are applied at the assembly level. These global assembly attributes can be information on the company, product, or even the languages it supports. The class is created automatically within the project and is housed in the Properties folder.

Setting the attributes

Setting attributes of the AssemblyInfo class can be accomplished two ways:

  • through the Assembly Information dialog box of your project’s Properties.
  • through the AssemblyInfo.cs file located within your Solution Explorer.

Assembly Information dialog box

To access the Assembly Information dialog box, double click the Properties file within your project’s solution on the Solution Explorer. This will raise the Properties Editor. Select the Application tab and then click the Assembly Information button to open the Assembly Information dialog box.


Modify the fields within the dialog box and click OK to save your settings. All changes will be saved within the AssemblyInfo.cs file. For more information on the Assembly Information Dialog Box, see Assembly Information Dialog Box.


AssemblyInfo.cs file

All of the information saved within the Assembly Information dialog box gets stored in the AssemblyInfo.cs file. This class file is maintained by Visual Studio and can be seen by expanding the Properties node in the Solution Explorer.

Open the file to see the project information located within the Assembly Information attributes. You can modify these attributes here for quicker editing instead of using the GUI editor.


Assembly Information attributes

The Assembly Information attributes are designed to house specific information about your project. The following table shows each attribute’s function:

Attribute Function
[AssemblyTitle] Specifies a title for the assembly.
[AssemblyDescription] A description of the product or modules that comprise the assembly.
[AssemblyConfiguration] Specifies the build configuration, such as debug or release.
[AssemblyCompany] Holds company information.
[AssemblyProduct] Displays product information.
[AssemblyCopyright] Holds copyright information for product or assembly.
[AssemblyTrademark] Assembly or product trademark information.
[AssemblyCulture] Provides information on what languages the assembly supports.

Accessing the attributes through code

To access the values of the AssemblyInfo.cs file within your C# code you will need to employ the System.Reflection namespace. The following code sample shows how to extract this information for your project:

        public static void Main()
            string company = ((AssemblyCompanyAttribute)Attribute.GetCustomAttribute(
                Assembly.GetExecutingAssembly(), typeof(AssemblyCompanyAttribute), false))
            string copyright = ((AssemblyCopyrightAttribute)Attribute.GetCustomAttribute(
                Assembly.GetExecutingAssembly(), typeof(AssemblyCopyrightAttribute), false))



This article showed where assembly level metadata is stored for your projects. It also demonstrated how to modify this information, what the field attributes are used for, and then how to use them within your code. Since each project receives an AssemblyInfo.cs file automatically, you now know how to prepare this information for use within your projects.


Namespace Aliases in C#

This article is also available on the Microsoft TechNet Wiki.

The C# language allows developers to create aliases for lengthy fully qualified names or class names. This can come in handy if there is a long namespace or class name that you do not want to have to keep typing out each time. It is also a useful tool to resolve namespace clashes within your code when identical types are imported into your code base.

To accomplish this you can employ the using keyword in C#. The alias lives within the scope of the namespace it Is declared in. When the code compiles, a token is created for the fully qualified name and the alias is then in effect.

For example, the following code snippet will declare an alias:

using diag = System.Diagnostics.Tracing;

The image below displays how to fully declare and use the alias: