Clearing the Microsoft Web Platform Installer cache

2150298078_23d7b7dec4_z

CC 2.0 image courtesy mightymightymatze on Flickr

If you are like me and have been using Visual Studio for a while, you have probably used the Microsoft Web Platform Installer (Web PI) in the past. Yet, with Visual Studio Code providing a more streamlined development experience, the Web Platform Installer has slowly taken a back seat.

If you used the Web PI a lot, you may be surprised to learn it caches the installer (.msi) files on your system and leaves them there taking up hard drive disk space.

This article shows you how to remove these files from the local folder cache.

Read more of this post

Advertisements

Free eBook: .NET Microservices – Architecture for Containerized .NET Applications

ebook-net-microservices

NOTE: This book is now in its second edition. See this blog post and this blog post for more information.

If you are like me and love all the free eBooks from Microsoft Press, a new one seems to have slipped under the radar.

.NET Microservices: Architecture for Containerized .NET Applications is an introduction to the architectural design and implementation of microservices-based applications and the management of them using .NET Core and Docker containers. This book is written by Cesar de la Torre, Bill Wagner, and Mike Rousos.

You can find out more information about the book via Cesar’s blog.

The eBook is available for free as a .PDF download: http://aka.ms/MicroservicesEbook. You can also explore the content online at docs.microsoft.com: https://aka.ms/microservices-guide-online-msft-docs.

Related Articles

.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.
    GUID_02
  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.

Troubleshooting

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.
        [ObsoleteAttribute]
        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()
        {
            Console.WriteLine(Method1());
            Console.WriteLine();
            Console.WriteLine(Method2());
            Console.WriteLine();
            Console.WriteLine(Method3());
        }
    }

The messages generated in the Error List appear as:

Error List

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

References

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.

WP_20151114_001

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

Related Articles