2016 Year in Review

new-year

With the new year upon us, it’s always worthwhile to reflect on the previous year.

So, just like I did last year, I compiled a list of general stats about this blog from 2016:

  • 17 new articles published.
  • 47,424 views.
  • 39, 477 visitors with 1.20 page views per visit.
  • Posts on the site received 5 likes and 7 comments.
  • 110 pictures uploaded.
  • The top referring site was StackOverflow.com.
  • There were visitors from 181 countries.
    • More than one-third of all page views came from the United States, followed by India and the United Kingdom.
    • The places with the least visits (one each) were Iran, Anguilla, Liberia, Burkina Faso, Guam, Martinique, Tajikistan, San Marino, Djibouti, Gibraltar, Vatican City, Eritrea.

Top 5 posts written in 2016

These five blog posts, written in 2016, received the most page views:

  1. Azure Infographics and Visio Templates (January 2016)
  2. Create GUID Tool in Visual Studio (January 2016)
  3. Understanding the Azure App Service Editor (December 2016)
  4. Using the Obsolete Attribute in C# (January 2016)
  5. Build Tour Toronto – June 10, 2016 (April 2016)

Top 5 posts from other years

These five posts from earlier years received the most traffic in 2016:

  1. Export an ODBC Data Source from the registry (July 2012)
  2. Using Notepad++ to write C# code (March 2014)
  3. PowerShell: Invoke-WebRequest and URL links (December 2014)
  4. Custom Telemetry Events with TrackEvent in Microsoft Application Insights (June 2015)
  5. Using Microsoft Application Insights in an MVC application (April 2015)

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.

Installation

To install the .NET Portability Analyzer via Visual Studio, follow the steps below:

  1. Start Visual Studio 2015.
  2. Select Tools > Extensions and Updates.
  3. Select Online > Visual Studio Gallery.
  4. Search for the .NET Portability Analyzer using the Search box.
  5. Find the extension and click Download.
  6. Click Install to accept the terms.
  7. Click Restart Now to restart Visual Studio and complete the installation.

Port01

You can also download the package from the Visual Studio Marketplace. Install the extension package (ApiPort.vsix) by double-clicking it. This adds the Analyzer to Visual Studio and its various options to the context menus.

Port02

Finally, if you want to test your code outside Visual Studio, you can always run it from the command line using the console app. It can be downloaded and run from the GitHub repository.

Settings

Return Visual Studio and navigate to Tools > Options. A new page is added labelled .NET Portability Analyzer.

Viewing the General tab, we can see how many project types Microsoft can now target. The Analyzer has options for Excel, .NET Framework 4.6.2, and .NET Standard 1.6 checked by default.

Select the Target Platforms and their versions for the platforms you want to check portability for. Click OK to save your selections.

Port03

Note that the .NET platform targets and report formats are retrieved from Azure and thus are updated constantly.

Running The Analyzer

To run the .NET Portability Analyzer, open a project to inspect. Select the Analyze Assembly Portability option from the Analyze menu. Note you can also adjust the Analyzer settings by using the Portability Analyzer Settings menu item.

Port04

An open file dialog appears. From here you can select your project executable or .dll file. The Analyzer runs and compiles a .NET Portability Report for the selected file. It is displayed in the Portability Analysis Results dialog. Click the Open Report link to see the full analysis.

Port05

The report opens in Microsoft Excel. The first tab shows a Portability Summary for the selected target platforms. Under each one it displays a percentage of how portable the application is for the chosen platform. For a default MVC Web Application project in Visual Studio, we can see it’s 79% compatible with .NET Core / ASP.NET Core but only 69% with the new .NET Standard library.

Port06

The Details tab maps the assemblies in the current project to see if they are supported on the target platforms. There is also a recommended changes column. The Missing assemblies tab charts which assemblies need to be added to a conversion project.

Port07

You can also run the Analyzer from the Solution Explorer. Right-click either your solution or project and select Analyze Assembly Portability. The Portability Summary dialog still appears but now you also see warnings in the Error List. Clicking an error shows the incompatible line of code.

Port08

Summary

This article has shown you how easy it is to use the Microsoft .NET Portability Analyzer when porting your project, solution, or binaries to other platforms. The tool can help you plan out your project conversions by listing any issues and recommending solutions.

References

Visual Studio’s Most Recently Used List

This article is also available on the Microsoft TechNet Wiki.

When presenting with Visual Studio at a conference, or if you want to share something with a client, you might not want to show all of your previous projects. To remedy this, Microsoft allows you to collapse and extend your Most Recently Used (MRU) list within Visual Studio 2015.

The default number of projects and files shown in Visual Studio 2015 is 10. If you are working on a large project, you can extend this number and if you want to see a smaller number of files, you can reduce it. As well, if you are presenting you can also set the number to zero to show no earlier items.

Modifying The MRU

To change the MRU settings within Visual Studio, go to Tools > Options > Environment > General.

image

The items shown in Window menu field controls the number of items displayed in the File > Recent Files and the File > Recent Projects and Solutions lists. Each will display recently opened project files or solutions.

image

The items shown in recently used lists controls the number of items shown under Recent on the left-hand side of the Start Page for Visual Studio. Each item is a shortcut to a recently opened project.

image

To expand or reduce the number of items in your lists, change the number in one or both boxes and click OK.

If you want to clear all of these lists (say for a presentation) you can set the fields to zero and no current items will be shown. Remember that the files are removed from the list and are not deleted from your file system.

Removing Individual Items From Start Page

To delete individual items from the Recent list on the Visual Studio Start Page, right-click an item and select Remove From List.

image

Summary

This article has shown you how to expand, contract, and clear your Most Recently Used lists within Visual Studio 2015. You can clear the entire list of recent items or just single ones.

References

Understanding the Azure App Service Editor

This article is also available on the Microsoft TechNet Wiki.

Azure App Service Editor is a new tool in Microsoft Azure. It is now available in preview in the Azure Portal.

The App Service Editor was formerly known as Visual Studio Online (Monaco). The tool provides a web-based editor for Azure Web Apps (previously Azure Web Sites). This allows you to make quick edits to your sites without having to open an IDE.

This article looks back on how to edit a web app with older technology (Kudu) and how to use the preview version of App Service Editor to make edits to your sites.

Kudu

Prior to the App Service Editor, the main way to view and edit deployed files was to use Kudu. Kudu is a set of tools for Azure App Service. It is also  the engine behind Git deployments in App Service. You can do other things with Kudu including viewing environment variables or the Kudu diagnostic dump, running processes, accessing a cmd console. It also provides a method for creating extensions.

There are two ways to view the Kudu service:

1. Every site has an associated ‘scm’ (Service Control Manager) service to run Kudu and the Site Extensions.

If your website has the URL http://mysite.azurewebsites.net/, then the root URL of the Kudu service is https://mysite.scm.azurewebsites.net/. Note the added scm token. This pattern also works with custom host names.

2. Within the Azure Portal, navigate to your web app. Scroll down to the Development Tools section on the left-hand navigation properties and click Advanced Tools. Within the Advanced Tools blade, click Go. A new browser tab appears with the Kudu Services dashboard displaying some basic app information.

AppServiceEditor01

Once you are in the Kudu Services dashboard, you can view, add, edit and delete web app files. To view the current files of your web app, click Debug console > CMD.

AppServiceEditor02

You will see the folder structure of your web app. To see your files, click site > wwwroot. This folder shows the deployed web app files. You can also see your current path in the page’s console window.

Use the icons to the left of the file to download, edit, or remove it. To add a file, drag it from your system onto the Kudu Services dashboard.

AppServiceEditor03

App Service Editor

An easier way to edit files now exists with the App Service Editor (Preview). As stated above, this is a web-based editor for modifying files already deployed to Azure Web Apps. You can see all the files on your site quickly through the file explorer.

Just as with Kudu, there are two ways to launch the App Service Editor. From the browser, if the Kudu URL is   https://mysite.scm.azurewebsites.net, you can add a /dev token. The root URL comes https://mysite.scm.azurewebsites.net/dev.

To launch the App Service Editor from the portal, scroll down to the Development Tools section on the left-hand navigation properties and click App Service Editor (Preview). Within the App Service Editor (Preview) blade, click Go.

AppServiceEditor04

A new browser tab appears with a web-based IDE opened to the WWWROOT folder of your app. At first glance, it looks like Visual Studio Code running in the browser, but it is the Monaco editor.

AppServiceEditor05

Editing a file is as simple as opening it and making the edits. App Service Editor (for better or worse) auto-saves your changes as you work and publishes them automatically. Everything you do is happening live on the site.This model is good for simple edits, but if you need to make changes to multiple files at once then publishing via Visual Studio or Git-based deployment is a better solution.

AppServiceEditor06

AppServiceEditor07

Video

The video below shows both Kudu and Azure App Service Editor in action:

To see the same video in larger format, view it on YouTube.

Conclusion

This article has shown you how the editing of files on Azure App Service has evolved from using Kudu exclusively to now having a choice between two tools. Give App Service Editor a try with your sites to see how easy it is to edit files.

See Also

References

More zombie process destroying scripts

Kill Your Zombie Process I wrote an article a few months back entitled Killing zombie Google Chrome processes. In the post, I talk about the fact Google Chrome can spin off multiple processes during a browsing session. When you close the browser window sometimes Chrome can leave behind several zombie processes in the Windows Task Manager.

Within the article, I presented two ways to solve this problem. I showed a PowerShell command and I also mentioned a fix through a batch script I created. I uploaded a copy of the Stop Google Chrome Processes batch script file to the TechNet Gallery.

Since then, I have created a similar batch file for other web browsers including Firefox, Explorer, Edge and Opera. All can be downloaded from the TechNet Gallery via the links below.