Skip to main content
Redhat Developers  Logo
  • AI

    Get started with AI

    • Red Hat AI
      Accelerate the development and deployment of enterprise AI solutions.
    • AI learning hub
      Explore learning materials and tools, organized by task.
    • AI interactive demos
      Click through scenarios with Red Hat AI, including training LLMs and more.
    • AI/ML learning paths
      Expand your OpenShift AI knowledge using these learning resources.
    • AI quickstarts
      Focused AI use cases designed for fast deployment on Red Hat AI platforms.
    • No-cost AI training
      Foundational Red Hat AI training.

    Featured resources

    • OpenShift AI learning
    • Open source AI for developers
    • AI product application development
    • Open source-powered AI/ML for hybrid cloud
    • AI and Node.js cheat sheet

    Red Hat AI Factory with NVIDIA

    • Red Hat AI Factory with NVIDIA is a co-engineered, enterprise-grade AI solution for building, deploying, and managing AI at scale across hybrid cloud environments.
    • Explore the solution
  • Learn

    Self-guided

    • Documentation
      Find answers, get step-by-step guidance, and learn how to use Red Hat products.
    • Learning paths
      Explore curated walkthroughs for common development tasks.
    • Guided learning
      Receive custom learning paths powered by our AI assistant.
    • See all learning

    Hands-on

    • Developer Sandbox
      Spin up Red Hat's products and technologies without setup or configuration.
    • Interactive labs
      Learn by doing in these hands-on, browser-based experiences.
    • Interactive demos
      Click through product features in these guided tours.

    Browse by topic

    • AI/ML
    • Automation
    • Java
    • Kubernetes
    • Linux
    • See all topics

    Training & certifications

    • Courses and exams
    • Certifications
    • Skills assessments
    • Red Hat Academy
    • Learning subscription
    • Explore training
  • Build

    Get started

    • Red Hat build of Podman Desktop
      A downloadable, local development hub to experiment with our products and builds.
    • Developer Sandbox
      Spin up Red Hat's products and technologies without setup or configuration.

    Download products

    • Access product downloads to start building and testing right away.
    • Red Hat Enterprise Linux
    • Red Hat AI
    • Red Hat OpenShift
    • Red Hat Ansible Automation Platform
    • See all products

    Featured

    • Red Hat build of OpenJDK
    • Red Hat JBoss Enterprise Application Platform
    • Red Hat OpenShift Dev Spaces
    • Red Hat Developer Toolset

    References

    • E-books
    • Documentation
    • Cheat sheets
    • Architecture center
  • Community

    Get involved

    • Events
    • Live AI events
    • Red Hat Summit
    • Red Hat Accelerators
    • Community discussions

    Follow along

    • Articles & blogs
    • Developer newsletter
    • Videos
    • Github

    Get help

    • Customer service
    • Customer support
    • Regional contacts
    • Find a partner

    Join the Red Hat Developer program

    • Download Red Hat products and project builds, access support documentation, learning content, and more.
    • Explore the benefits

.NET Core Magic: Develop on one OS, run on another

June 19, 2017
Don Schenck
Related topics:
.NET

    I recently attempted to write a blog post about Angular and .NET Core 2.0 [Note: It will be posted as soon as the .NET Core 2.0 RPMs are released], using my Red Hat Enterprise Linux (RHEL) VM as the operating system. Even though the .NET Core 2.0 bits are not available yet from Red Hat, I gave it a shot by using a daily build. When I tried to run the code, however, I got an error related to the Roslyn compiler. Sometimes, when you play with fire -- i.e. a daily build -- you get burned.

    And that's when the creative juices, combined with the knowledge of .NET Core's Self-contained deployment technology (you might also see it referred to as a "Standalone app") came to the rescue.

    Since everything was working in Windows, what if I created, debugged and built the application on my Windows 10 machine, but deployed it to my RHEL VM? I don't have docker for Windows on my PC, so I'd have to use some command line wizardry to pull this off. As it turns out the wizardry was as simple a third-grade magic trick.

    Creating the Angular App

    Creating the angular app was one command: dotnet new angular. Boom ... Angular app. Granted, it's just scaffolding and a tiny demo app, but hey ... this is about the underlying technology, not the app itself. Sometime in the future... (Dreams of writing a fantastic app using Angular, then remembers his existing technical debt) ... yeah, where was I?

    Creating the Angular app/scaffolding yields the following, by the way:

    Running the Angular App

    At this point, all I need to do is restore the dependencies and run the program:

    Success! Now I simply open my browser and point it to localhost:5000 and I have my Angular app. Here's the browser screenshot:

    Wait. What happened? This is supposed to be easy!

    Flipping over to the PowerShell session where I launched my app, I found the following error:

    Chocolatey to the Rescue

    Aha! Angular needs Node.js to be installed. And this brought me to the coolest part of this exercise. On a whim, based on experience and knowing how things are supposed to work, I tried the following command to install Node.js: choco install nodejs ... and it worked!

    Up and Running on Windows

    I then ran refreshenv (as chocolatey was kind enough to suggest) to reload my environment variables and PATH settings and tried running dotnet run again. I refreshed my browser (which was still looking for localhost:5000) and was rewarded with a running app:

    Running the Build on RHEL

    So after installing Node.js, the app is running. Now I can build it to run on RHEL by using the following command: dotnet publish -c Release -r rhel.7.2-x64. This creates a DLL in a directory under the project:

    Because I have the directory (bin/Release/netcoreapp1.1/rhel.7.2-x64/publish) shared between my Windows 10 host machine and the RHEL VM, I can switch over to the VM and run the DLL.

    But it occurs to me: I'll need Node.js on my RHEL VM as well if I want this to work.

    So, hopping over to my RHEL VM, I installed Node.js using the following commands (which I found at the Node.js website):
    [Note: I had to log in as super user (su) in order for these commands to work.]

    curl --silent --location https://rpm.nodesource.com/setup_8.x | bash -
    yum -y install nodejs

    Now that my RHEL VM has Node.js installed, I should be able to run the DLL that I compiled from within Windows: The application, compiled on my Windows PC, is running on Linux. That is pretty cool.

    Exposing the Web Site

    But here's the only problem: It's using localhost. I need to expose the web server so it can be reached from outside of my VM, i.e. a browser running on my Windows PC. To accomplish this, I can use an environment variable, ASPNETCORE_URLS, as follows:

    export ASPNETCORE_URLS="http://*:5000"

    Now when I run bin/Release/netcoreapp1.1/rhel.7.2-x64/publish/angular on my Linux VM -- remember, the code was compiled on my Windows PC -- I have the following:

    Finally, I can point my browser to the IP address of the VM and see the Angular website, compiled on Windows, running on RHEL:

    Review

    To review: In this particular case, the need to install Node.js complicated the issue. In a "Happy Path" scenario, it's as simple as this:

    1. Build the code on your Windows PC, targeting RHEL.
    2. Install (or share) the created DLL on your RHEL system.
    3. Run the app on your RHEL system.

    Hmmm ... can this code run in a Linux container now? That's for my next blog entry.

    For additional information and articles on .NET Core visit our .NET Core web page for more on this topic.


    If you know the basic commands of Linux then download the Advanced Linux Commands Cheat Sheet, this cheat sheet can help you take your skills to the next level.

    Last updated: September 3, 2019

    Recent Posts

    • MCP servers vs. skills: Choosing the right context for your AI

    • How to route external and local LLMs with Models-as-a-Service

    • Protect data offloaded to GPU-accelerated environments with OpenShift sandboxed containers

    • Case study: Measuring energy efficiency on the x64 platform

    • How to prevent AI inference stack silent failures

    Red Hat Developers logo LinkedIn YouTube Twitter Facebook

    Platforms

    • Red Hat AI
    • Red Hat Enterprise Linux
    • Red Hat OpenShift
    • Red Hat Ansible Automation Platform
    • See all products

    Build

    • Developer Sandbox
    • Developer tools
    • Interactive tutorials
    • API catalog

    Quicklinks

    • Learning resources
    • E-books
    • Cheat sheets
    • Blog
    • Events
    • Newsletter

    Communicate

    • About us
    • Contact sales
    • Find a partner
    • Report a website issue
    • Site status dashboard
    • Report a security problem

    RED HAT DEVELOPER

    Build here. Go anywhere.

    We serve the builders. The problem solvers who create careers with code.

    Join us if you’re a developer, software engineer, web designer, front-end designer, UX designer, computer scientist, architect, tester, product manager, project manager or team lead.

    Sign me up

    Red Hat legal and privacy links

    • About Red Hat
    • Jobs
    • Events
    • Locations
    • Contact Red Hat
    • Red Hat Blog
    • Inclusion at Red Hat
    • Cool Stuff Store
    • Red Hat Summit
    © 2026 Red Hat

    Red Hat legal and privacy links

    • Privacy statement
    • Terms of use
    • All policies and guidelines
    • Digital accessibility

    Chat Support

    Please log in with your Red Hat account to access chat support.