Using ligatures in your IDE

A couple of days ago I read a very cool blog post by Scott Hanselman about Monospaced Programming Fonts with Ligatures.

I had never heard about the word ligatures, but he explains it quite well. They are ‘characters’ which are made up by combining multiple individual characters as one. Apparently this is quite common in the Arabic languages. Well, no matter, the thing that does matter is the fact you can use this inside your development environment also!

In order to use ligatures, just install the Fira Code font (or any other font which supports ligatures) on your development machine and you are ready to go! It might be a good idea to place the zip file in your OneDrive folder, so it’s available on all of your machines.

Visual Studio automatically supports ligatures, you just have to select a font which has them. So, head down to the Fonts and Colors setting and change the Plain Text font to Fira Code Retina.

image

Note, I had to use the Fira Code Retina font. I first tried the Fira Code font, but I didn’t see any ligatures pop up. There aren’t many differences between the non-retina and the retina version, so just use the one which works best for you.

Read more →

Starting with Azure Functions

Lately, I’ve been busy learning more about creating serverless solutions. Because my main interest lies within the Microsoft Azure stack I surely had to check out the Azure Functions offering.

Azure Functions enable you to create a serverless solutions which are completely event-based. As it’s located within the Azure space, you can integrate easily with all of the other Azure services, like for example the service bus, Cosmos DB, storage, but also external services like SendGrid and GitHub!

All of these integrations are fine and all, but seeing Azure Functions perform in action is still easiest with regular HTTP triggers. You can just navigate with a browser (or Postman) to a URL and your function will be activated immediately. I guess most people will create these kind of functions in order to learn to work with them, at least that’s what I did.

Creating your Azure Functions App

In order to create Azure Functions, you first have to create a so called Function App in the Azure Portal. Creating such an app is quite easy, the only thing you have to think about is which type of Hosting Plan you want to use. At this time there are 2 options, the Consumption Plan or the App Service Plan.

Read more →

Using Application Insights in your log4net application

In my previous post I’ve described how to use Application Insights and use it within your new web application. Most of us aren’t working in a greenfield project, so new solutions have to be integrated with the old.
The project I’m working on uses log4net for logging messages, exceptions, etc. In order for us to use Application Insights, we had to search for a solution to integrate both. After having done some research on the subject we discovered this wasn’t a big problem.

The software we are working on are Windows Services and Console Applications, so we should not add the Application Insights package for web applications. For these kind of applications it’s enough to just add the core package to your project(s).

image_thumb7

Once added, we are creating the TelemetryClient in the Main of the application.

private static void Main(string[] args)
{
	var telemetryClient = new TelemetryClient { InstrumentationKey = "[InstrumentationKey]" };
	/*Do our application logic*/
	telemetryClient.Flush();
}

You will notice we are setting the InstrumentationKey property explicitly. That’s because we don’t use an ApplicationInsights.config file, like in the web application example and this key has to be specified in order to start logging.

This final flush will make sure all pending messages will be pushed to the Application Insights portal right away.

Read more →

Adding Application Insights to your application

Some time ago the Application Insights became available as a preview in the Azure portal. Application Insights helps you monitor the state of an application, server, clients, etc. As said, it’s still in preview, but it’s rather stable and very easy to use and implement in your applications.

The documentation is still being worked on, but with all the getting started guides on the Microsoft site you can kick start your project with it in a couple of minutes.

The main reason for me to dig into Application Insights is because we still had to implement a proper logging solution for our applications which are migrating to the Azure Cloud. As it happened, Application Insights just became available at the time and because of the tight Azure integration we were really eager to check it out (not saying you can’t use it with non-Azure software of course).

If you want to start using Application Insights, the first thing you will have to do is creating a new Application Insights application. You will be asked what type of application you want to use.

image

It’s wise to select the proper application type over here, because a lot of settings and measuring graphs will be set for you depending on the choice made over here. For this example I’ll choose the ASP.NET web application. After having waited for a few minutes the initial (empty) dashboard will be shown.

Read more →

Black lines in the watch window

On some installations of Visual Studio 2010, 2012 or 2013 I’m confronted with strange behavior. One of these strange things are the black lines in the Watch Window of Visual Studio. Just like the screenshot below (this isn’t my screenshot, I’ve ‘borrowed’ it from someone else)

187351

Normally this has something to do with the graphics driver, but updating these drivers doesn’t work all the times. There’s also a work around for this problem, described on the MSDN forum.

The work around is:

  • Go to Tools > Options > Environment > Font and Colors

  • Search for the settings for [Watch, Locals, and Autos Tool Windows]

  • For Text select the Default for Item ForegroundThe options will look something like the image below.

image

After you’ve set this option you’ll be able to see the text in your watch window again. The lines will be white again with black text.

Read more →

Don’t build your solutions in Visual Studio

The solutions in the project I’m working on are quite big and can easily take up 30 to 90 seconds to build, even though we have rather fast laptops. This is probably because of some build-plugins we are forced to use and the tight SharePoint integration of those plugins. Nevertheless, it’s quite annoying to see Visual Studio ‘hang’ every time you build your solution.

Last week I had some time on my hands to do some research on how we could improve these long builds. Turns out you can call MSBuild directly and let your solution compile outside of the Visual Studio instance. The build will still take up about the same amount of time, but it’s less annoying as you can still do some work in Visual Studio.

I’ve used Scott Hanselman’s blogpost to create some new External Tools in Visual Studio, placed them in my Menu and created keyboard shortcuts for them.

At the moment I’ve got 3 new items in my menu to build my complete solution, clean my complete solution and to build the project I’m currently working in.

clip_image001

The ‘Clean Solution’ button bound to the default out-of-the-box functionality, offered by Visual Studio.

The External Tool ‘Solution (MSBuild)’ is configured like so:

Read more →

Get your references when pulling a project via NuGet

Because of a failing hard drive I had to re-install my Windows installation, including cloning all of my BitBucket repositories back to my projects folder.

Getting all the solutions back on the local development machine is very easy, but after opening, I discovered they couldn’t be build anymore. The reason for this: several references were missing. This wasn’t that strange at all, because these references were libraries pulled pulled down via NuGet and not pushed into the repository.

I had suspected there was something in NuGet which would make it easy to download the referenced packages. Reason for me to expect this is the packages.config file which is created after pulling down NuGet packages. This file contains all the information needed to re-download them, you see?

<?xml version="1.0" encoding="utf-8"?>
<packages>
  <package id="FluentAssertions" version="1.7.1.1" />
  <package id="Moq" version="4.0.10827" />
</packages>

At the moment there isn’t an option (i.e.: I couldn’t find it) to re-download the referenced libraries in the NuGet package manager. After doing a bit more research on the matter I discovered a page in the NuGet documentation called ‘Using NuGet without committing packages to source control’.

Over there they tell you to use the ‘Enable NuGet Package Restore’-option, which is available after right-clicking on the solution file.

Read more →

SharePoint 2007 development in Visual Studio 2010

Aan mij was de taak om een applicatie te schrijven welke informatie van SharePoint (Wiki sites) website kon wegschrijven naar HTML bestanden met een bepaalde opmaak.

Niks aan de hand, ware het niet dat ik op m’n Windows 2008 VM zowel MOSS 2007 als Visual Studio 2010 had geinstalleerd. Bij het toevoegen van de benodigde references kwam ik er ineens achter dat ik de SharePoint 2007 DLL’s niet kon vinden in de lijst. Het is ook een bekend ‘probleem’, aangezien het ook op Connect staat geregistreerd als issue. Er staat ook dat het probleem is geescaleerd naar het betreffende team, maar dat was al op 20 november 2009. Jammer dat dergelijke calls dan niet verder worden bijgewerkt, want blijkbaar is het antwoord gewoon ‘zoek het lekker zelf uit’.

Gelukkig kan ik dat ook prima zelf uitzoeken.

De dll’s staan namelijk gewoon in de map C:\Program Files\Common Files\Microsoft Shared\Web Server Extenstions\12\ISAPI.
Door de Browse knop te gebruiken bij het Add Reference scherm kan dan gewoon, net als vroeger, de betreffende dll worden geselecteerd, bijvoorbeeld Microsoft.SharePoint.dll.

Het werkt dan allemaal prima, maar is wel jammer dat dit niet standaard wordt ondersteund. Het is al erg genoeg dat we met Visual Studio 2008 ook al niet met SharePoint 2010 kunnen werken.

Read more →

Public key token in Visual Studio

Onlangs liep ik weer tegen het probleem aan dat ik de PublicKeyToken van m’n gegenereerde assembly moest zien te vinden. Er zijn natuurlijk verschillende mogelijkheden om hier achter te komen, maar de mooiste is toch wel de tip van Jeremia Clark.

Op z’n weblog heeft hij beschreven hoe hij de token krijgt door middel van het aanmaken van een nieuw External Tools commando, de link: https://blogs.msdn.com/b/miah/archive/2008/02/19/visual-studio-tip-get-public-key-token-for-a-stong-named-assembly.aspx

Het is dus de bedoeling om een nieuw commando te maken welke sn.exe oproept.

Als argument wordt er dan -T $(TargetPath) opgegeven.

Nog even het vinkje aan zetten dat de waarde in de Output window moet komen en klaar is het. Nu kun je vanuit het Tools menu heel snel de Public Key Token achterhalen.

Read more →

VS2010b2 IntelliSense probleem

Ik had in VS2010b2 een probleem dat er bij javascript geen IntelliSense verscheen. Na het melden van deze bug bij MS Connect hebben ze het geregistreerd en met een tijdelijke workaround gekomen.

Wat blijkt, als je de target wijzigt in bijvoorbeeld XHTML1.1 krijg je gelijk IntelliSense die je wilt.
Wat ook wordt aangeraden is om al je settings te resetten. Op zich kan dat wel natuurlijk, maar dat is niet echt ideaal. Hier gaan ze er op verder: https://blogs.msdn.com/webdevtools/archive/2009/10/23/visual-studio-2010-beta-2-intellisense-issue-in-javascript-html.aspx

Komt er dus op neer dat je bij de ‘Import and Export’ wizard je settings moet resetten en dan voor Web Development moet kiezen als standaard ontwikkel view. Op zich is dit natuurlijk niet echt een super oplossing, maar ik vind het wel gaaf om te zien dat er echt iets wordt gedaan met de meldingen van het beta product. Zal binnenkort wat intensiever bezig gaan met VS2010 om te kijken of ik nog wat meer kan vinden.

Read more →