With recent changes the to the .NET ecosystem, developers of popular languages such as C# now have the ability to develop and deploy .NET applications across multiple platforms including OS X and Linux.
This is made possible thanks to the .NET Core, a modular implementation of the .NET framework capable of supporting both web and console applications.

Aside from opening up opportunities to a new pool of potential developers, .NET Core also enabled these applications to take advantage of certain technologies they were previously restricted from.
One of these technologies in particular is Linux Containers. Containerized .NET applications can now benefit from a wide range of features built into containerization technologies such as Docker. This includes a rapid application deployment cycle and portability across machines whether they are located on physical, virtual or hosted in a cloud environment.

In addition, since these applications are running in containers, they are also eligible to be run in OpenShift. OpenShift provides the flexibility to manage and run containerized applications while also providing the tools necessary for developers to be productive.
It is this ecosystem that gives developers the flexibility and freedom to easily build and deploy applications, without needing to be concerned about the underlying infrastructure.


Getting up and running developing .NET web applications with OpenShift Online is as simple as it gets. You can either use the Web Console or the CLI tools, but we'll focus on the Web Console. If you want further information about the CLI tools check our Beyond the basics guide on the OpenShift Docs.

It's recommended to have a beginner understanding of OpenShift Online (Next Gen) in order to follow the instructions on this blog post, if you find yourself in need of more information check the Getting Started on the OpenShift Docs.

Web Console

Here are the steps using the web console:

  1. Login to your Openshift Online account and select or create a project
  2. Click Add to Project then search and select dotnet:latest
  3. For the Git Repository URL use the sample which is provided (https://github.com/openshift-s2i/s2i-aspnet-example) or, alternatively, fork the example repository and use your own URL.
    .NET example
  4. Hit Create button! Your app is created and the build process should start soon. Head over to the project overview page to see additional details about your app
    Overview page with a .NET App
  5. After the app has been built, you can preview it by clicking the URL on the top

That's it! Your app is deployed and available to the world! In the next sections we'll go over making changes to your application and how to automatically deploy them to OpenShift.

Making Changes to the App

Now that your app is all set up and ready to roll, it's time to make your own changes. Firstly, we should enable auto deployments by using the provided WebHooks. Here's how:

  1. If you haven't done so already, fork the example repository into your account.
  2. Then, on the Web Console Go to Browse > Builds > awesome-app > Configuration > Actions > Edit and change the Source Repository URL to your own repository
  3. To enable the webhooks, go back to Browse > Builds > awesome-app > Configuration and grab the GitHub webhook URL
  4. Go back to your GitHub repository and add the webhook to Settings > Webhooks & services
    Edit build configuration and grab GitHub webhook URL

Now that the basic configurations are done, it's time for editing the app locally:

  1. Use a terminal or git client of your choice and clone the repository:
$ git clone git@github.com:your-username/s2i-aspnet-example.git
  1. Make changes to the app, for instance, edit the app/Views/Home/index.cshtml file.
  2. Then add, commit and push your changes with git:
$ git add app/Views/Home/index.cshtml
$ git commit -m "Update index to test auto deployments"
$ git push origin master

Now that your changes are pushed to your GitHub repository you should see a new build in progress at the overview page of the Web Console. That's it! You've successfully deployed your own .NET app with OpenShift Online!

Extra info

  1. To work with .NET core in an IDE you need Microsoft Visual Studio update 3 or higher. In fact, the first patch to update 3 is what you actually need.
  2. If you have an existing .NET application and you want to know if it will work on .NET core, you can use .NET Portability Analyzer plug-in in Visual Studio.


News, OpenShift Online

< Back to the blog