Category Archives: Microsoft

.Net: Core

So we’ve looked at the .Net Framework which was limited to Windows, now lets check out .Net Core…

.Net Core was announced by Microsoft in June, 2016 and showed a new path they were creating the .Net ecosystem, and while this new direction was based on C# and the .Net Framework it was quite different.

Two of the biggest changes for the .Net ecosystem was it would be cross-platform and released across Windows, macOS, and Linux at the same time, in contrast to the .Net Framework only ever having been available on Windows. The second change was that .Net Core was going to be Open-Source, that is COMPLETELY Open-Source, meaning the code is available for us to review so we can get a better understanding of what is actually happening. But also the community is encouraged to actually get involved by way of pull requests and the like. This means we actually get our eyes on the Framework and documentation, raise issues such as bug reports, fix bugs, recommend or implement improvements, and add additional functionality. Not bad right?

The origin of .Net Core came from developers requesting that ASP.NET ran on multiple platforms and not just Windows. From there we got ASP.NET 5 and Entity Framework 7, which to be honest was more than a little confusing considering we had .Net Framework 4.6 and Entity Framework 6 you’d expect them to be the next releases right? Not so, so we got .Net Core, ASP.NET Core, and Entity Framework Core to show the distinction between the two ecosystems.

Since the announcement in 2016, we’ve seen the release of .Net Core 1.0, .Net Core 1.1 released in March 2017, .Net Core 2.0 released in August 2017, and .Net Core announced in May 2018 and we’re currently at .Net Core 3 Preview 3 as of March 2019. So we’re making some decent progress and getting more and more functionality with each release.
But what is driving these releases? Microsoft is developing their .Net offering (Core and Framework) inline with a formal specification call the .Net Standard which we are currently at version 2.0. The goal is to have the whole .Net ecosystem establish uniformity. The image below is directly from Microsoft and as they say “a picture paints a thousand words”, which I think makes their goal a bit more obvious.

I haven’t touched on Xamarin because I want to save that for its own post. Check out this post for a very quick intro though.

From the image and the statement above their goal is to have a single library which can be used for the .Net Framework, .Net Core, and Xamarin.

By use of the NuGet Package Manager we can download .Net Standard or third party created packages which contain just the constructs or functionality we need, greatly reducing our production footprint. An example is if you need a JSON parser you could swing by the NuGet Package Manager and add an implementation of your choice, such as JSON.Net to your project. This is a very easy and very quick way for us to develop and we don’t have to find implementations out on the web that may or may not do what we need.

In addition we have also been given Command Line Support, that is we can create, develop, build, test, and publish our applications all from the command line, again all cross-platform. Certainly worth looking into further so keep an eye out for that post if it interests you.
We also get the Universal Windows Platform (UWP), which you can see in the image above, which follows Microsofts write once run anywhere approach. By using UWP we can run the same code on multiple Windows platforms including IOT device (like Raspberry Pi), Mobiles Device running Windows 10 Mobile, PC, Hololens, Surface Devices, and even on Xbox One.

If you checked out the Xamarin post I mentioned above you’ll know Xamarin is a cross-platform development framework, so if we combined our development activities between .Net Core and Xamarin we can get both a huge amount of code reuse and a massive market penetration.

So to round of the .Net Core discussion, we can get a huge amount of code reuse through cross-platform support, we get more visibility of what the framework is doing and increased confidence through community involvement with it being Open-Source, we only use what we need resulting in smaller binaries and dependencies and increased performance, and we have full command line support. Quite exciting…

I hope you have found this post informative or at the very least interesting. I’m looking forward to writing up more .Net related posts in the future.

.NET: Framework

I’m going to start putting together some posts related to the world of .Net (pronounced ‘dot net’). I’m a big fan of .Net and figured it could be useful.

For this post I wanted to target the .Net Framework. So lets get stuck in…

The .NET Framework was formally released in 2002 by Microsoft and is one of the most commonly used methods of Software Development, hopefully something you’re interested in? If not, stick around, check out some of my other posts and see what happens…

The .Net Framework implements the Common Language Infrastructure (CLI) which is an Open Specification developed by Microsoft, with Hewlett-Packard, Intel, and others and the specification was standardised by the International Organisation for Standardization (ISO) and the European Computer Manufacturers Association (ECMA) completing in 2003.
The .Net Framework includes a large Class Library called the Framework Class Library (FCL) and a runtime environment called the Common Language Runtime (CLR).
Applications can be developed using multiple programming languages including C# (pronounced ‘C Sharp’), Visual Basic.NET, and F# (pronounced ‘F Sharp’) with language interoperability. We get a large number of APIs from the framework we can use for example database access using ADO.Net and the Entity Framework, web development including apps and services with ASP.Net, desktop services with the Windows Communication Foundation (WCF), and User Interface Development with Windows Presentation Foundation (WPF). So we can do quite a variety of development through the .Net Framework and to avoid getting side tracked I won’t go into any more detail on the above usage paths in this post, they really deserve their own posts.

Before we could develop .Net Framework applications we primarily used the Component Object Model (COM), at least on Windows, to share code across languages and for cross application communication. Sounds ok right? Well not really, COM was complicated and fragile. So Microsoft quite kindly developed the .Net Framework and it quickly took the place of COM.

Ok so we know .Net is great and all but what is it exactly?
As touched on above it comes in two primary parts the CLR and the FCL.

The runtime environment (CLR) takes a fair bit of work away from us such as finding, loading, and managing .Net objects. It means we don’t really need to worry about memory management (unless we’re using unmanaged code), app hosting, thread coordination, type safety, garbage collection, exception handling, security checks, and other low-level details. By use of Just-In-Time compilation, the runtime converts our managed code (called the Common Intermediate Language (CIL) into machine instructions, called binary, understood by the computer.
As part of the CLR, we get something called the Common Type System (CTS) which is a standard that describes type definitions and programming constructs supported by the runtime. The goal here is to allow our applications to easily share information among themselves, even if those applications are written in different .Net languages.
One more step down we have the Common Language Specification (CLS) and this specification defines a subset of type and constructs. If you end up writing a library where the types are only CLS-compliant this library can be used across all .Net languages.
See the image below for a visual representation…

Common Language Runtime visual

Lets look at the FCL, it is the .Net Frameworks implementation of the standard libraries defined by the Common Language Infrastructure (CLI). The core part of the FCL is the Base Class Library (BCL) as the name suggests this core section contains only the base essentials such as:

  • Threading
  • Security
  • File Input/Output (I/O)
  • Base types; such as Object
  • Collections
  • and more

I’ll put a post up that is just the namespaces and a brief description.

The FCL on a wider scale includes everything and can be used to develop any type of software application from web to console (Xbox).

So that’s a very quick introduction to the .Net Framework, hopefully you found it interesting.

If you have any questions feel free to ask.

Setting up a Visual Studio 2017 Environment

Intro

Hey all, so today I’m going to give you a quick run through for setting up a development environment using Visual Studio 2017 Community on Windows 10. There will be a tutorial on how to do this on a Linux environment with a different IDE but for now as I will be focusing on Visual Studio for development.

Not much else to say there, let’s get into it…


Steps:

Up to date Windows 10

The first thing we want to do is ensure that our Windows 10 development machine is up to date.

  • This can be found in Settings -> Update & Security -> Windows Update

Download Visual Studio 2017

Now we are happy our machine is up to date next we want to download the Visual Studio 2017 installer. So the next thing we want to do is download Visual Studio 2017

  • There are other versions available for those with the required Key or Subscription level, they are:
      • Visual Studio 2017 Professional
    • Visual Studio 2017 Enterprise

We will only be looking at Community Edition, but the steps will be the same.

Install Visual Studio 2017 Community Edition

  • Once you’ve downloaded Visual Studio lets install it

  • Double click on the installer
      • You’ll find it in your Downloads folder normally set to ‘C:\Users\<Your Username>\Downloads’
    • You may need to approve the installation via the User Account Control authorisation window. I assume as you are here you’re happy to install Visual Studio 2017, so click ‘Yes’

  • Next up will be to review Microsoft’s Privacy Statement and Software Licence Terms
    • Pretty standard stuff.
    • Click ‘Yes’

  • The Installer will then fetch and install some additional dependencies

  • So, now we get to configure our Development Environment. For our purposes I’m only going to choose those components we MAY want to use in the future, that is components I intend to use in any posts I make. You can, of course, install any components you wish outside of my choices. So we will want:
      • .NET desktop development
      • Desktop development with C++
      • Universal Windows Platform development
      • ASP.NET and web development
      • Azure development
      • Python development
      • Data storage and processing
      • Mobile development with .NET
      • Visual Studio extension development
    • .NET Core cross-platform development

NOTE: You will need to ensure you have enough space to install the components. Please see the red box the above image it shows the ‘Total space required’ for your configuration.

    • You can change where you want the installation to go, see the green box in the above image
      • In some cases, some of the components will have a set installation path which you cannot change.
  • That’s it, for now at least, the Visual Studio Installer will now install Visual Studio, this will take a little while. Could be worth grabbing a brew or something and if you haven’t done so already check out some of my other posts.

Start Visual Studio 2017 Community Edition

Great, so Visual Studio should now be installed for you, I recommend you restart your machine but it’s not necessary. Let’s open Visual Studio now then, there’s a couple of ways to do this:

  • Start Menu
      • Open the Start Menu using the Windows key
      • Scroll to ‘V’ named apps
    • You will see ‘Visual Studio 2017’, click it.
    • Desktop Shortcut
        • Navigate to your desktop, press Windows Key + D
      • Double click, ‘Visual Studio 2017’
  • Search bar
      • Open the Start Menu by pressing the ‘Windows Key’
      • Type ‘Visual Studio 2017’
    • Visual Studio 2017 will now be in the Start Menu Best match options

There will be some configuration we need to do as part of our first startup

  • You’ll be asked to sign in to your Microsoft account if you have one.
    • If you don’t, I’d recommend you get one and sign into it.
    • If you do, sign in
      • Especially if you have an MSDN subscription
  • Next up and nearing the end, some simple IDE configuring
    • Leave Development Settings as ‘General’
      • Though feel free to look into this in more detail and selection and option more suitable for your plans
    • Then choose your Color Theme

We are done, Visual Studio  2017 will now be installed and you can take a look round if you want.

Hopefully, my steps were useful and you managed to install it. If you have any problems feel free to get in touch and I’ll help in any way I can (though I imagine you’ll likely google any issues).

Next up then we’ll make a very simple C# application, should be out shortly.