.Net core and Visual Studio code

.NET Core provides a blazing rapid and modular platform for building server apps, which run on Windows, Mac and Linux. Visual Studio code, with the C# extension could be used to have a powerful editing experience with complete support for C# and debugging.

MOST RECENT OPEN SOURCE TECHNOLOGY

Open source and cross-platform development are integral for the current and future strategies of Microsoft. A lot of building blocks of the .NET stack have become open sourced, while others are developed to embrace and support the new strategy. .NET Core at present is the most recent open source technology for creating cross-platform apps for the web and cloud, which runs on Mac OS X, Linux and Windows.

.NET Core enables writing MVC(Model-View-Controller) apps with C# and relies on .NET Core, the new open source as well as cross-platform modular set of runtimes, compilers and libraries in RC as well. The biggest advantage of .NET Core is that it is entirely independent from any integrated development environment or proprietary project systems, meaning that one could also build an ASP.NET Core app outside Visual Studio.

.Net core and Visual Studio code

USING COMMAND LINE TOOLS

Building an ASP.NET Core application could be accomplished by using several command-line tools to scaffold, create and run apps, while Visual Studio Code could be used for editing. There is plenty of work in progress yet, thus some features may change until it reaches the RTM or Release-to-Manufacturing milestone. For example, ASP.NET Core used to rely on the .NET Execution environment and he command-line interface for building and managing apps. Since .NET Core is created upon .NET Core, DNX would be retire and the CLI would switch to the .NET Core command-line tools for future releases, thus it is important to bear in mind if one wants to start writing cross-platform web applications with ASP.NET Core and C#.

CREATING A SIMPLE DATABASE

The first thing to do is to create a database to work with. One could use an existing database or define the data model with the Entity Framework Code First approach, but support for migrations of code in ASP.NET Core is still in progress and aren’t stable at this time. Thus, one simply creates a new database, which stores a list of car models and the names of the manufacturers.

GETTING STARTED

  1. Installing .NET Core. Whether the OS is Windows, Mac OS or Linux, the instructions for getting .NET core on a machine could be followed. When installation is complete, one should be able to open a command line interface or CMD, PowerShell for Windows, Terminal for both Linux and MacOS and check out if the installation was successful through executing the command: dotnet PowerShell>Output for the dotnet command in PowerShell. The output is the same for Linux and MacOS. At this point, .NET Core has been installed successfully and one could begin building apps.
  2. Creating a .NET Core app using the command line interface. In Windows PowerShell or Linux/MacOS Terminal, one could create a new directory. A new console app could be made using the dotnet new command.
  3. Installing Visual Studio Code. To get IntelliSense working, one should install the C# extension for Visual Studio Code, which also installs OmniSharp for IntelliSense. After it installs, it should be enabled and VS Code should be restarted. At this point, one could open the folder with the earlier VS Code project. This could be done via the command line by using code.
  4. Running in Visual Studio code. To enable debugging and running code from VS Code, a prompt is revealed, asking to add the configuration files. This would add a .vscode folder in the solution root with a couple of .json files-tasks.json and launch.json. The app could be run by proceeding to the Debug pane or pressing Ctrl (Cmd) +Shift+D and then pressing the run button or F5. If everything goes well, one should be able to view the output in the debug console.
  5. Adding classes and navigating through code. At this point, one could start using VS Code to its full potential. IntelliSense, navigating code, code completion and going to definitions. A full list of VS Code tips and tricks could be seen on the official Microsoft GitHub organization.

Getting started with ASP.NET Core and Visual Studio Code is pretty simple and straightforward. One could look forward to everything else in store for the Visual Studio Code. Visual Studio Code goes a step further in running code analytics to locate code issues, which make it less clear, perform worse or adhere to bad practices. Visual Studio could remove all unnecessary using directives from a file. This also handles a lot of things, such as code that is unreachable, case statements and more.

Dive into the .NET Core world and learn how to build easy-to-maintain web apps with Visual Studio Code.

Advertisements

Why .NET Core is open source

.NET Core is open source

The shift in the way enterprises want to do development explains a lot on the open sourcing of .NET as well as ASP.NET. In part, it is to get the community involved to take advantage of the expertise and ideas of developers who embrace open source projects. Software organizations such as Xamarin and Fog Creek that wrote their own. NET compilers already replaced those with open source Roslyn .NET compiler by Microsoft.

The .NET Core project is under the .NET Foundation’s stewardship. This is believed to be a critical part of promoting and advancing .NET Core stack. There are two huge reasons why .NET Core was made open source. One is to lay the foundation for cross platform .NET and build and leverage a more robust ecosystem.

THE IMPORTANCE OF COMMUNITY

Microsoft plans on working with developers in the community, which include Mono community to bring .NET to both Mac OS and Linux. The relevance of embracing community contributions was one of the major discussion points in the preparations of Microsoft to go open source with the .NET’s server side.

This is somewhat a surprising move by Microsoft that is a win for all who are involved. It means that the .NET communities and mono developers now could work together in a unified pool wherein more resources and tools become available to them. Simultaneously, it provides all developers with a bigger set of platforms on which to deploy their apps, such as Linux, Mac OS, Android and iOS. A clear win for Linux adopters is the upcoming .NET apps influx that now could be ported and deployed there, together with a big number of .NET developers who could maintain the applications and bring new ones to light.

To support the open source community around .NET, Microsoft spawned the .NET Foundation. They have an organization portal on GitHub wherein the source code of the core libraries of .NET is published under the MIT License. Moreover, Microsoft wants to bring the technologies to Linux, largely in part due to Azure. Running a cloud platform provides Microsoft an interest in Linux which goes far beyond the open source contributions that the Windows Server team has been doing to the Linux kernel so distributions would run on its Hyper-V hypervisor.

MOVING TO MICRO-SERVICES

In itself, NET is changing as the recent name change for the open source version, from .NET Core 5 to Core 1.0 underlines. Furthermore, .NET Core does not even cover as much as the full .NET 4.6 since it doesn’t have for instance the server-side graphics libraries. The same goes to ASP.NET 4.6 and 5 which has the Web API but not the VB or F# or Web API support. The newer versions do not completely replace the present versions, although they will get the missing pieces later on. Moreover, they are also built in a new method, with more emphasis on moving forward and faster releases than avoiding breaking changes. For the last decade, Microsoft’s building Azure has taught the company a lot with regards to advantages of micro-services for what otherwise would be huge, monolithic apps. The original front-end managed resources such as storage, compute, networking and the core infrastructure components for the entire worldwide serve in a single application. It was a big and complicated codebase that runs on a single data center and took up to a month to release an update after it was finished and tested, meaning that it was only updated once a quarter. Moreover, the management tools for all the various components were secured by one certificate.

WHAT WAS MADE OPEN SOURCE?

Numerous server side stack layers of .NET were made available on open source licenses. In particular, the C# compiler Roslyn was made open source earlier this year under the Apache 2.0 License. Roslyn’s source code could be downloaded from codeplex. Furthermore, guidelines on how to join and contribute were made available.

.NET Core is a modular development stack which is the foundation for all future platforms of .NET. It was made available under the MIT License. The present partial release includes libraries that provide support for Metadata Reader, Immutable Containers, XML management and SIMD vector types. In addition, there is a new Visual Studio 2015 version. It is a free but not an open source version of VS Community 2013 which replaces Visual Studio Express which has for several years the free version of VS IDE. At this point, the code allowing .NET to run on iOS and Linux has not been made yet. It’s expected to be released in the next few months.

The new .NET Core stack will be entirely open source on GitHub. Microsoft has made the necessary changes already.

Microsoft is experimenting with the next Big Tech trend

Microsoft

Microsoft is experimenting with the next big technology trends, which is the AI and machine learning. The company is determined to not miss out on AI or artificial intelligence, the next big trend in tech that over time, would filter into how everyone uses software, hardware and the internet. Unlike mobile that the company missed and continues to miss by a mile, Microsoft has been working hard to be on top of artificial intelligence, both in terms of research and integration of it into products.

MICROSOFT’S MUCH SUCCESS IN ARTIFICIAL INTELLIGNECE RESEARCH

One of the major reasons that Microsoft has had so much success in artificial intelligence research so far is down to Microsoft Research. It’s the 1,000-strong arm of the organization, which specifically deals in scientific research, even if it is not part of the core business of Microsoft. Top scientists at Microsoft Research created a list of predictions and a lot of them focus on AI, which is a big trend today, showing that it is a huge focus for the company. One of the huge focuses for Microsoft Research is AI or artificial intelligence, both practically and scientifically for products. Artificial intelligence would become a big deal.

MACHINE LEARNING TECHIQUES AND ARTIFICIAL INTELLIGENCE

It is a fact that millions of people all over the world suffer from visual impairment. A new program from Microsoft uses machine learning techniques as well as artificial intelligence to help diagnose and treat the condition. Microsoft teamed with the non-profit LV Prasad Eye Institute or LVPEI in India that provided the computing giant with access to over a million anonymized medical records. The records were tossed into the cloud-based machine learning program of Microsoft and processed.

The data provided Microsoft the ability to see through and analyze a wide array of procedures, offering a better understanding as to why a specific operation is chosen and the results of various surgeries for eye patients. Using an Azure machine learning program and Power BI service, Microsoft was able to use data to help doctors make decisions. Furthermore, the company was able to convey to a doctor the amount of time a patient has until the visual further degrades. It also was able to predict how successful a certain procedure could be. Although Microsoft has not said officially just how success the program has been, it seems confident enough in its initiative to take it on the road.

IMPROVING PEOPLE’S HEALTH AROUND THE GLOBE

The success of a program such as Microsoft’s could be integral in boosting the health of people all over the world. According to WHO or the World Health Organization, around 285 million people are visually impaired, which include 38 million who are blind. WHO estimates that eight percent of visual impairments could be treated. Microsoft’s thinking has swayed to AI, including a series of high-profile acquisitions and an entire section of the company that’s called the Garage that’s dedicated to building applications, most of which have artificial intelligence or built-in machine learning. All of the acquisitions add knowledge to the teams of Microsoft and bring products, which bear the name of the company onto devices, particularly those that are made by Apple or that run Android.

ACQUISITIONS

Microsoft earlier announced that the company’s acquiring SwiftKey, a London-based startup that has built one of the most popular keyboards for Android and iPhone devices. The technology behind SwiftKey is in a large part driven by artificial intelligence and machine learning. Most people speculated that the SwiftKey acquisition has to do with bringing Word Flow, the default keyboard on Windows Phone, to the iPhone. Nonetheless, the blog posts, both from Microsoft and SwiftKey announcing the acquisition has made it clear that this was not the case, that Microsoft wanted the team and technology behind the keyboard application.

The acquisition does show several things, such as:

  • Microsoft now is able to make high-profile, huge acquisitions again and most of all, engineers at hip firms want to work with the giant company.
  • Microsoft is serious on bringing people to cover areas it wants to change or expand. Accompli, an Outlook client for iPhone that was acquired by Microsoft last year is another example of this.
  • There would likely be more acquisitions in the future.

Other than SwiftKey, Microsoft also acquired other companies, most of which are more startups, which, among other things have an artificial intelligence component. This include Double Labs that makes an Android home screen, which intelligently orders items and Metanautix, a big-data company.

The one huge takeaway from Microsoft’s experiments with machine learning and artificial intelligence is that it’s keeping up with Google and others.

Why choose .NET Core?

.NET Core

Twelve years since the first .NET framework release, developers ended up with several, fragmented version of .NET for various platforms. From .NET Compact Framework to Windows Phone, Framework to Silverlight and Windows Store apps, each time, Microsoft has taken .NET to a new platform. Supposedly the common language runtime ended up with a varying subset: every time, there is a different runtime, application model and framework with various development done at every layer and APIs which go back to a common code base but have not always remained in common.

WHAT YOU GET FROM .NET CORE

Indeed, various platforms always will have different capabilities and features, but as .NET becomes open source and spreads beyond the platforms that Microsoft controls, having a common core instead of a set of subsets that are loosely coupled gets even more important. That is the basic for .NET Core and the open source strategy of .NET.

MODULAR, AGILE, OPEN

The .NET framework core is mscorlib that has Windows-centric features such as App Domains and remoting. This means that each time .NET goes to a new platform, it requires a new core. Add the fact that the framework on every new platform is created and maintained by a different team, with its own shipping and version at various times, one gets plenty of divergences. The portable class libraries began to push the platforms closer together but with varying code bases, the same thing are implemented many times.

The combination of the need to build .NET in a more modular and agile way and not wanting to implement the same thing a lot of times when it could be just written once explains why .NET Core stack appears the way it does. .NET Core has a new runtime, CoreCLR that got the just-in-time compiler and the type system, VM, garbage collection as well as other run-time pieces. That is the same level as Mono runtime or .NET Native runtime. Above are the Base Class Libraries from NuGet, such as immutable collections. And, above that is the application model, such as ASP.NET, that bootstraps the CoreCLR and also adds features such as dynamic compilation and NuGet resolution.

THE .NET CORE TECHNOLOGY

The technology of .NET Core makes sense for a cross-platform environment. Thus, this is a strategy by Microsoft that developers should pay attention to. Some of the more pessimistic feedback about the plans tends to underestimate the changes scope or assume a sort of idealized past when .NET has created as a more modular cross-platform stack all along. .NET Core is the Mono componentized version of the full framework that developers work on with Mono. It would in time turn as a de facto cross-platform implementation for stacks.

KEY BENEFITS OF .NET CORE

MODULARITY. NuGet packages became the standard method of adding new functionality to apps. Since Visual Studio 2010, developers used the Package Manager Console and NuGet Package Manager for installing and configuring libraries and frameworks. Now this has been extended to include the core ASP.NET features. The developer could pick and choose which features of ASP.NET to include in the solutions. This opt-in model enables developers to be more deliberate when it comes to which libraries are included in the projects.

OPEN SOURCE.

All .NET Core 1.0 packages could be found at the GitHub site. Microsoft and the developer community embraced the open source software transparency. All projects are updated actively by both contributors of Microsoft and the community at large. This approach allows a quicker development cycle as well as continuous code enhancement.

UNIFIED MVC AND WEB.API.

In previous versions, WEB API and MVC were based on various versions of the framework. At a minimum, the differences in namespace organization, concepts and classes led to confusion. For instance, the base class controllers were in a different namespace compared to the common result interface for controller actions. This was resolved by .NET Core 1.0 MVC with a single set of objects within one namespace. This is a standardized approach that simplifies the development of both MVC and WEB.API endpoints.

CROSS PLATFORM

.NET Core 1.0 would run on the current .NET framework but designed to use the new .NET Core 1.0. When .NET Core is targeted, the code of the framework would be packaged with the deployed application. This .NET version has been ported to perform on Linux and OSX. Furthermore, this extends the .NET development usability beyond the Windows platforms. If developers want to work in Linux or OSX, Microsoft developed Visual Studio Code that allows a user to develop on any of the platforms.

The modular design of .NET Core, updated programming language, and productivity enhancements are sure to make the framework popular with software developers.