“dotnet: command not found” after installing the Microsoft .NET Core SDK on a Mac

This content is 7 years old. I don't routinely update old blog posts as they are only intended to represent a view at a particular point in time. Please be warned that the information here may be out of date.

Whilst installing the Microsoft .NET Core SDK on my MacBook earlier last week, I found that the instructions on the Microsoft website were not quite complete.

Microsoft tells us to run a few commands to install OpenSSL:

  1. Install Homebrew (it was already on my system)
  2. Then run:

brew update
brew install openssl
mkdir -p /usr/local/lib
ln -s /usr/local/opt/openssl/lib/libcrypto.1.0.0.dylib /usr/local/lib/
ln -s /usr/local/opt/openssl/lib/libssl.1.0.0.dylib /usr/local/lib/

After this, you should be able to download and install the .NET Core SDK package (version 1.0.4 seems to be the latest version of the SDK at the time of writing, which includes .NET Core 1.0 and 1.1).

Then, in theory, running the dotnet command should be all that’s required but, for me, it resulted in an error:

-bash: dotnet: command not found

The fix, it seems, is to create another symbolic link:

ln -s /usr/local/share/dotnet/dotnet /usr/local/bin/

After that, dotnet ran as expected.

For reference, My MacBook is running MacOS Sierra version 0.12.5 (16F73).

Introduction to Microsoft .NET Standard

This content is 7 years old. I don't routinely update old blog posts as they are only intended to represent a view at a particular point in time. Please be warned that the information here may be out of date.

A few months ago, I was (along with about 70 other rMVPs) privileged to be on a Skype call with Scott Hanselman (@shanselman) as he gave an overview into Microsoft .NET Core. Some of what was discussed was confidential but the general overview of how .NET Core fits with the full .NET Framework and with Mono/Xamarin was a great education for a non-developer like me and it seems fine to reproduce it here for the benefit of others.

This is part 2 of a 2-part series. In part 1, I explained .NET versions and the lightweight, cross-platform Microsoft .NET Core SDK. This post moves on to look at standardising Microsoft .NET.

Where does .NET Standard fit in?

Hopefully in part 1, I showed how .NET Core is a fantastically quick to run set of development tools that can run across platforms but you might also have heard of .NET Standard.

Over the years, the .NET landscape has become pretty complicated (the discussion on versions just scrapes the surface) and we should really think of “.NET” as a big umbrella for marketing purposes with three main instances:

  1. Microsoft .NET Framework is really the .NET (Full) Framework – it runs on Windows clients and servers.
  2. Microsoft .NET Core is for server applications with no UI and is ideally suited to microservices, Docker containers, web apps and more. It runs on Windows, MacOS and multiple Linux distributions.
  3. Mono (led by Xamarin) is an open source cleanroom implementation of .NET – written without access to the code. Its developers looked at the interfaces/shape and made new versions, which means it has the benefit of running anywhere (e.g. “exotic places” like a Sony Playstation, or on tiny devices).

That means .NET code can, theoretically run anywhere. Except that the versioning gets in the way… and that’s where .NET Standard fits in.

.NET Standard is a target. Not a platform. Not a runtime. It’s an “agreement”.

If that’s difficult to understand, here’s the analogy thatScott Hanselman (@shanselman) used in a recent webcast: Android developers don’t target an Android OS (e.g. v4.3), they target an API level (e.g. 15). If a new API is released that provides new capabilities, a developer can move to the new API level but it might not work on older devices.

Microsoft has something like this in Portable Class Libraries, except they are the lowest common denominator – the centre of a Venn diagram. .NET Standard is about running anywhere so that if a developer targets their application to a standard, they can be sure it will run wherever that standard is supported.

The .NET Platform Support table demonstrates this and indicates the minimum version of the platform that’s needed to implement that .NET Standard.

.NET Platforms Support table
.NET Platforms Support table as at July 2017

For example, if you want to run on .NET Framework 4.5 and .NET Core 1.0, the highest .NET Standard version you can use is .NET Standard 1.1; if you want to run on Windows 8.1 you can’t go above .NET Standard 1.2; etc. The higher the version, the more APIs are available and the lower the version, the more platforms implement the standard. Developers target a framework for specific Windows APIs and target a .NET standard for portability and flexibility.

Resources

Introduction to Microsoft .NET Core

This content is 7 years old. I don't routinely update old blog posts as they are only intended to represent a view at a particular point in time. Please be warned that the information here may be out of date.

A few months ago, I was (along with about 70 other rMVPs) privileged to be on a Skype call with Scott Hanselman (@shanselman) as he gave an overview into Microsoft .NET Core. Some of what was discussed was confidential but the general overview of how .NET Core fits with the full .NET Framework and with Mono/Xamarin was a great education for a non-developer like me and it seems fine to reproduce it here for the benefit of others.

This is part 1 of a 2-part series, looking at .NET versions and the Microsoft .NET Core SDK. Tomorrow’s post moves on to look at Microsoft .NET Standard.

.NET versions

The first thing to understand is that .NET versioning is a mess [my words, not Scott’s]:

On a Windows machine with Visual Studio installed, open a command prompt and type clrver -all. Chances are you’ll see versions 2.0 and 4.0. cd C:\Windows\Microsoft.NET\Framework and on my Windows 10/Office 2016 machine I can see versions 1.0.3705, 1.1.4322, 2.0.50727 and 4.0.30319.

So where is .NET 3.0? Well, 3.0 and 3.5 were the Windows Presentation Framework (WPF) and Windows Communication Framework (WCF), running on v2.0 of the Common Language Runtime (CLR). They are actually part of Windows!

All of this makes developing for the .NET framework tricky. Side by side running for .NET 4.x is at the CLR level – if your app is developed for 4.6 and others are for 4.0, you may have a hard time convincing IT operations people to update and chances are you’ll need to drop down to 4.0.

That (together with cross-platform capabilities) is where .NET Core comes in.

Creating simple applications with the .NET Core SDK

.NET Core is in C:\Program Files\DotNet and is implemented as a driver (dotnet.dll). With a few simple commands we can create and run a console application:

dotnet new console

dotnet restore

dotnet run

That’s three steps to Hello World!

It’s just as simple for a web application:

dotnet new web

dotnet restore

dotnet run

Then browse to http://localhost:5000.

One difference in the web app is the presence of the

<Project Sdk="Microsoft.NET.Sdk.Web">

line in the .csproj file. This signifies a “meta package” – a package of packages that avoids explicitly listing multiple package references (for cleaner code).

Unlike in the (full) .NET Framework, we can specify the version of .NET Core to use in the .csproj file, meaning that multiple versions of the SDK can be used with whatever variety of libraries are needed:

<TargetFramework>netcoreapp1.1</TargetFramework>

We can also add references to libraries with dotnet add reference libraryname. Adding a package with dotnet add package packagename not only adds it but restores, downloads and checks compatibility. Meanwhile dotnet new solution creates a solution file – something that would be complex to do manually.

Why revert to a CLI?

So we’ve seen that you can be a successful .NET programmer without a visual editor. We can build an entire project system from the command line. .NET Core is not just about involving the Linux community with a cross-platform version of .NET but also about speed and Scott used an analogy of thinking of the CLI as creating a “2D” version to validate before working on the full “3D” GUI version.

In the background (under the covers), the .NET Core SDK uses the NuGet package manager (dotnet add package), MSBuild (dotnet build) and VSTest (dotnet new xunit and dotnet test).

Visual Studio gives a better user interface but we can develop the basics very quickly using a command line and then get the best of both worlds – both CLI and GUI. What .NET Core does is lower the barrier to entry – getting up and running writing Microsoft.NET code in just a few minutes, for Windows, MacOS or Linux.

Resources

A quick guide to Microsoft .NET Framework versions

This content is 15 years old. I don't routinely update old blog posts as they are only intended to represent a view at a particular point in time. Please be warned that the information here may be out of date.

Microsoft .NET logoI’ve never really understood why certain applications require installation of the Microsoft .NET Framework, even though there’s already a version included within the operating system. Surely each version of the framework includes previous versions? Well, it seems not – as David Allen from the Microsoft UK ISV Developer Evangelism Team explained to me recently:

  • The original version of the Microsoft .NET Framework (v1.0.3705.0) was released in 2002. Version 1.1.4322.573 updated both the framework and the common language runtime (CLR) and was included within Windows Server 2003.
  • With version 2.0.50727.42, Microsoft again updated both the framework (classes) and the CLR but this version was incompatible with v1.x and the two could be run side by side on the same system.
  • It’s logical to think that v3.x (a major release) would also include a new CLR but 3.0.4506.30 (which shipped with Windows Vista and Windows Server 2008) and 3.5.21022.8 (shipping with Windows 7 and Windows Server 2008 R2) add new framework classes but use the existing v2.0 CLR.
  • The next version will be 4.0 and is currently in beta. This will include a new CLR and will run side by side with v1.x and v2.x/3.x installations on the same system.

It’s no wonder I was confused – it’s a complete mess! A .NET Framework application that requires v2.0 will happily run on a system with v3.5 but a v1.x application needs v1.1 to be installed, and a v4.x application will require v4.0. It’s entirely feasible that, in the near future, a Windows 7 machine may need v1.1, v3.5 SP1 and v4.0 to all be installed to support different applications.

To find out which versions are installed on a given system, take a look in the %systemroot%\Microsoft.NET\Framework folder. Futher information on the various releases of the Microsoft .NET Framework (including service packs) is available on MSDN.

PC, phone and web: How Microsoft plans to build the next generation of user experiences

This content is 16 years old. I don't routinely update old blog posts as they are only intended to represent a view at a particular point in time. Please be warned that the information here may be out of date.

Channel 9 man watching PDC onlineI’m supposed to be taking a week off work, but the announcements coming out of Microsoft’s PDC have the potential to make a huge impact on the way that we experience our IT. So, it’s day 2 of PDC and I’ve spent the afternoon and evening watching the keynote and blogging about new developments in Windows…

Yesterday I wrote about Ray Ozzie’s PDC keynote during which the Windows Azure services platform was announced. Today, he was back on stage – this time with a team of Microsoft executives talking about the client platform, operating system and application innovations that provide the front end user experience in Microsoft’s vision of the future of personal computing. And, throughout the presentation, there was one phrase that kept on coming back:

PC, phone and web.

Over the years, PCs have changed a lot but the fundamental features have been flexibility, resilience and adaptability to changing needs. Now the PC is adapting again for the web-centred era.

Right now, the ‘net and a PC are still two worlds – we’ve barely scratched the surface of how to take the most value of the web and the personal computer combined.

PC, phone, and web.

Ozzie spoke of the most fundamental PC advantage being the fact that the operating system and applications are right next to the hardware – allowing the user experience to take advantage of multiple, high resolution, screens, voice, touch, drag and drop (to combine applications), storage (for confidentiallity, mobility, and speed of access) so that users may richly create, consume, interact with, and edit information. The PC is a personal information management device.

The power of the web is its global reach – using the ‘net we can communicate with anyone, anywhere and the Internet is “every company’s front door” – a common meeting place. The unique value of the web is the ability to assemble the world’s people, organisation, services and devices – so that we can communicate, transact and share.

Like PCs, phone software is close to the hardware and it has full access to the capabilities of each device – but with the unique advantage is that it’s always with the user – and it knows where they are (location) and at what time – providing spontaneity for capture and delivery of information.

Microsoft’s vision includes applications that spans devices in a seamless experience – harnessing the power of all three access methods.

PC, phone and web.

“We need these platforms to work together and yet we also want access to the full power and capabilities of each”

[Ray Ozzie, Chief Software Architect, Microsoft Corporation]

I won’t cover all of the detail of the 2-and-a-half hour presentation here, but the following highlights cover the main points from the keynote.

Steven Sinofsky, Senior Vice President for Microsoft’s Windows and Windows Live Engineering Group spoke about how Windows 7 and Server 2008 R2 share the same kernel but today’s focus is on the client product:

  • Sinofsky brought Julie Larson-Green, Corporate Vice President, Windows Experience on stage to show off the new features in Windows 7. Windows 7 is worth a blog post (or few) of its own, but the highlights were:
    • User interface enhancements, including new taskbar functionality and access to the ribbon interface for developer.
    • Jump lists (menus on right click) from multiple locations in the user interface.
    • Libraries which allow for searching across multiple computers).
    • Touch capabilities – for all applications through mouse driver translation, but enhanced for touch-aware applications with gestures and a touch-screen keyboard.
    • DirectX – harnessing the power of modern graphics hardware and providing an API for access, not just to games but also to 2D graphics, animation and fine text.
    • And, of course, the fundamentals – security, reliability, compatibility and performance.
  • Windows Update, music metadata, online help are all service-based. Windows 7 makes use of Microsoft’s services platform with Internet Explorer 8 to access the web. Using technologies such as those provided by Windows Live Essentials (an optional download with support for Windows Live or third party services via standard protocols), Microsoft plans to expand the PC experience to the Internet with software plus services.

PC, phone and web.

“We certainly got a lot of feedback about Windows Vista at RTM!”

[Steven Sinofsky, Senior Vice President, Microsoft Corporation]

  • Sinofsky spoke of the key lessons from the Windows Vista experience, outlining key lessons learned as:
    • Readiness of ecosystem – vendor support, etc. Vista changed a lot of things and Windows 7 uses the same kernel as Windows Vista and Server 2008 so there are no ecosystem changes.
    • Standards support – e.g. the need for Internet Explorer to fully support web standards and support for OpenXML documents in Windows applets.
    • Compatibilty – Vista may be more secure but UAC has not been without its challenges.
    • Scenarios – end to end experience – working with partners, hardware and software to provide scenarios for technology to add value.
  • Today, Microsoft is releasing a pre-beta milestone build of Windows 7, milestone 3, which is not yet feature complete.
  • In early 2009, a feature complete beta will ship (to a broader audience) but it will still not be ready to benchmark. It will incorporate a feedback tool which will package the context of what is happening along with feedback alongside the opt-in customer experience improvement program which provides additional, anonymous, telemetry to Microsoft.
  • There will also be a release candidate before final product release and, officially, Microsoft has no information yet about availability but Sinofsky did say that 3 years from the general availability of Windows Vista will be around about the right time.

Next up was Scott Guthrie, Corporate Vice President for Microsoft’s .NET Developer Division who explained that:

  • Windows 7 will support .NET or Win32 client development with new tools including new APIs, updated foundation class library and Visual Studio 2010.
  • Microsoft .NET Framework (.NET FX) 3.5 SP1 is built in to Windows 7, including many performance enhancements and improved 3D graphics.
  • A new Windows Presentation Framework (WPF) toolkit for the .NET FX 3.5 SP1 was released today for all versions of Windows.
  • .NET FX 4 will be the next version of the framework with WPF improvements and improved fundamentals, including the ability to load multiple common language runtime versions inside the same application.
  • Visual Studio 2010 is built on WPF – more than just graphics but improvements to the development environment too and an early CTP will be released to PDC attendees this week.
    In a demonstration, Tesco and Conchango demonstrated a WPF client application for tesco.com aiming to save us money (every little helps) but to spend more of it with Tesco! This application features a Tesco at home gadget with a to do list, delivery and special offer information and providing access to a “corkboard”. The corkboard is the hub of familiy life, with meal planning, calendar integration, the ability to add ingredients to the basket, recipes (including adjusting quantities) and, calorie counts. In addition, the application includes a 3D product wall to find an item among 30,000 products, look at the detail and organise products into lists, and the demonstration culminated with Conchango’s Paul Dawson scanning a product barcode to add it to the shopping list.
  • Windows 7 also includes Internet Explorer 8 and ASP.NET improvements for web developers. In addition, Microsoft claims that Silverlight is now on 1 in 4 machines connected to the Internet, allowing for .NET applications to run inside the browser.
  • Microsoft also announced the Silverlight toolkit with additional controls on features from WPF for Silverlight 2 as a free of charge toolkit and Visual Studio 2010 will include a Silverlight designer.

David Treadwell, Corporate Vice President, Live Platform Services spoke about how the Live Services component within Windows Azure creates a bridge to connect applications, across devices:

PC, phone and web.

  • The core services are focused around identity (e.g. Live ID as an openID provider), directory (e.g. the Microsoft services connector and federation gateway), communications and presence (e.g. the ability to enhance websites with IM functionality) and search and geospacial capabilities.
  • These services may be easily integrated using standards based protocols – not just on a Microsoft .NET platform but invoke from any application stack.
  • Microsoft has 460 million Live Services users who account for 11% of total Internet minutes and the supporting infrastructure includes 100,000s of servers worldwide.
  • We still have islands of computing resources and Live Mesh bridges these islands with a core synchronisation concept but Mesh is just the tip of the iceberg and is now a key component of Live Services to allow apps and websites to connect users, devices, applications and to provide data synchronisation.
  • The Live Service Framework provides access to Live Services, including a Live operating environment and programming model.
  • Ori Amiga, Group Program Manager – demonstrated using Live Framework to extend an application to find data on multiple devices, with contact integration for sharing. Changes to the object and its metadata were synchronised and reflected on another machie without any user action and a mobile device was used to added data to the mesh, which sychronised with other devices and with shared contacts.
  • Anthony Rhodes, Head of Online Media for BBC iPlayer (which, at its peak, accounts for 10% of the UK’s entire Internet bandwidth) spoke of how iPlayer is moving from an Internet catchup (broadcast 1.0) service to a model where the Internet replaces television (broadcast 2.0) using Live Mesh with a local Silverlight application. Inventing a new word (“meshified”), Rhodes explained how users can share content between one another and across devices (e.g. watch a program on the way to work, resuming playing from where it left off on the computer).

In the final segment, before Ray Ozzie returned to the stage, Takeshi Numoto, General Manager for the Office Client spoke of how Microsoft Office should be about working the way that users want to:

  • Numoto announced Office web applications for Word, Excel, OneNote and PowerPoint as part of Office 14 and introduced the Office Live Workspace, built on Live Services to allow collaboration on documents.
  • In a demonstration, a document was edited without locks or read only access – each version of the document was synchronised and included presence for collaborators to reach out using e-mail, instant messaging or a phone call. Office web applications work in Internet Explorer, Firefox or Safari and are enhanced with Silverlight. Changes are reflected in each collaborator’s view but data may also be published to websites (e.g. a Windows Live Spaces blog) using REST APIs so that as the data changes, so does the published document, extending office documents onto the web.
  • Office Web apps are just a part of Office 14 and more details will be released as Office 14 is developed.
  • Numoto summarised his segment by highlighting that the future of productivity is diversity in the way that people work – bringing people and data together in a great collaboration experience which spans…

PC, phone and web.

  • In effect, software plus services extends Office into connected productivity. In a direct reference to Google Apps, Microsoft’s aspirations are about more than just docs and speadsheets in a browser accessed over the web but combine to create an integrated solution which provides more value – with creation on the PC, sharing and collaboration on the web and placing information within arms reach on the phone. Seamless connected productivity – an Office across platform boundaries – an office without walls.

PC, phone and web.

Windows vs. Walls
Software plus services is about combining the best of Windows and the best of the web. Windows and Windows Live together in a seamless experience – a Windows without walls. All of this is real – but, as Ray Ozzie explained, it’s also nascent – this is really just the beginning of Microsoft’s future computing platform and, based on what Microsoft spoke of in yesterday and today’s PDC keynotes, the company is investing heaviliy in and innovating on the Windows platform. Google may have been one to watch lately but it would be foolish to write off Windows just yet – Microsoft’s brave new world is enormous.

Compiling C# code without access to Visual Studio

This content is 17 years old. I don't routinely update old blog posts as they are only intended to represent a view at a particular point in time. Please be warned that the information here may be out of date.

I’m not a developer and as such I don’t have a copy of Visual Studio but this evening I needed to compile somebody else’s C# code to produce a dynamic link library (DLL) and call it from a Windows PowerShell script. Somewhere back in my distant past I recall using Turbo Pascal, Borland C++, early versions of Visual Basic and even Modula-2 to make/link/compile executables but I’ve never used a modern compiled language (even on Linux I avoid rolling my own code and opt for RPM-based installations). So I downloaded and installed Visual C# 2005 Express Edition (plus service pack 1, plus hotfix to make it run on Windows Vista).

Sadly that didn’t get me anywhere – I’m totally confused in the Visual Studio IDE and anyway, the instructions I had told me to access the Visual Studio command prompt and run csc /t:library filename.cs.

It turns out that the Visual Studio Express Editions don’t include the Visual Studio command prompt but in any case, the C# compiler (csc.exe) is not part of Visual Studio but comes with the Microsoft.NET framework (on my system it is available at %systemroot%\Microsoft.NET\Framework\v2.0.50727\). Once I discovered the whereabouts of the compiler, compiling the code was a straightforward operation.

As for what I did with the DLL and PowerShell, I’ll save that for another post.

Warming up SharePoint

This content is 17 years old. I don't routinely update old blog posts as they are only intended to represent a view at a particular point in time. Please be warned that the information here may be out of date.

I’m spending a few days this week learning about how to implement an enterprise search solution using Microsoft Office SharePoint Server (MOSS) 2007 (so expect a few SharePoint-related posts to follow over the next few days). I was intrigued to note that the Virtual PC image used for the training course included a number of “warm up” scripts for SharePoint. Not having come across this before, I was intrigued as to their purpose but my instructor (Martin Harwar from English Tiger) explained that the principle is equally applicable to all ASP.NET applications and is about improving the end user experience.

Normally, ASP.NET applications are compiled on a just in time (JIT) basis and this means that the first page load after making changes such as resetting IIS, refreshing application pools or editing web.config can be very slow. By “warming up” the application (accessing key pages deliberately), JIT compilation is triggered, meaning that when an end user accesses the page then it is already compiled (and hence fast).

Joel Oleson’s SharePoint Land has a much better explaination as well as the actual MOSS warmup scripts for download. There are also some more comments on warming up SharePoint at Andrew Connell’s SharePoint developer tips and tricks site.

Incidentally, the scripts on Joel’s site are intended for MOSS but can be modified for WSS (and I understand that the principle may be equally applicable to other ASP.NET web applications).

Microsoft developer road trip CD

This content is 19 years old. I don't routinely update old blog posts as they are only intended to represent a view at a particular point in time. Please be warned that the information here may be out of date.

In a few days time, Microsoft are launching a whole host of products including Visual Studio 2005 and SQL Server 2005. To complement the launch events and associated webcasts, Microsoft have produced the Microsoft developer road trip CD – a 45 minute audio download featuring information on Visual Studio 2005, SQL Server 2005 and the .NET Framework 2.0 from Microsoft’s own developer and platform group experts.

Designed to be listened to on the move, either in the car or on your favourite media player, this should allow you to get up to speed on what these new product releases are all about in just a few short trips.