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

Welcome to Red Hat Enterprise Linux, MSBuild, a build tool for .NET Core CLI!

<p>&nbsp;</p> <quillbot-extension-portal></quillbot-extension-portal>

January 6, 2017
Takayoshi Tanaka
Related topics:
.NETLinux
Related products:
Red Hat Enterprise Linux

    Microsoft announced the first "alpha" release of the new MSBuild-based .NET Core tools. .NET Core SDK which can be downloaded from the Red Hat Developer Program site consists of .NET Core Runtime and .NET Core command line tools (.NET Core CLI). (Reminder - you must have a Red Hat Enterprise Linux subscription first.  If you don't, you can go here for a no-cost subscription.) The MSBuild tool is included in .NET Core 1.0 preview 3 (not in the latest release .NET Core 1.1). The version number is something complicated because .NET CLI is not GA but still under preview. The MSBuild tool can be used with both .NET Core 1.0 and .NET Core 1.1 runtimes. RHEL is not listed in the .NET Core SDK 1.0 Preview 3 download list. But you can try MSBuild with the .NET Core CLI daily build.

    NOTE: Red Hat has just released .NET Core 1.1. However, .NET Core 1.1 doesn't include the MSBuild tool, you can try MSBuild following this blog.

    Install .NET Core daily build

    We can get the download link in the dotnet/cli repository. This build is now under development as preview 5. After downloading the latest .NET Core SDK Binaries for RHEL 7.2, please execute the following commands to install.

    $ sudo mkdir -p /opt/dotnet
    $ sudo tar zxf dotnet.tar.gz -C /opt/dotnet
    $ sudo ln -s /opt/dotnet/dotnet /usr/local/bin

    You can update the SDK again with the same commands above after downloading a new binary when a new daily build is available. If you have already installed the .NET Core SDK via Red Hat Software Collections or other places, please be sure to configure the PATH environmental variable. Here is my environment.

    $ which dotnet
    /opt/dotnet/dotnet
    $ dotnet --info
    .NET Command Line Tools (1.0.0-preview4-004130)
    
    Product Information:
     Version:            1.0.0-preview4-004130
     Commit SHA-1 hash:  a0060ac321
    
    Runtime Environment:
     OS Name:     rhel
     OS Version:  7.3
     OS Platform: Linux
     RID:         rhel.7.2-x64
     Base Path:   /opt/dotnet/sdk/1.0.0-preview4-004130

    Working with csproj

    The new dotnet CLI tools generate csproj instead of project.json.

    $ dotnet new
    Created new C# project in /home/tanaka-takayoshi/MSBuildSample.
    $ ls
    MSBuildSample.csproj  Program.cs

    "dotnet restore" and "dotnet run" are the same as before.

    $ dotnet restore
      Restoring packages for /home/tanaka-takayoshi/MSBuildSample/MSBuildSample.csproj...
      Writing lock file to disk. Path: /home/tanaka-takayoshi/MSBuildSample/obj/project.assets.json
      Generating MSBuild file /home/tanaka-takayoshi/MSBuildSample/obj/MSBuildSample.csproj.nuget.g.targets.
      Generating MSBuild file /home/tanaka-takayoshi/MSBuildSample/obj/MSBuildSample.csproj.nuget.g.props.
      Restore completed in 486.995ms for /home/tanaka-takayoshi/MSBuildSample/MSBuildSample.csproj.
    
      NuGet Config files used:
          /home/tanaka-takayoshi/.nuget/NuGet/NuGet.Config
    
      Feeds used:
          https://api.nuget.org/v3/index.json
    $ dotnet run
    Hello World!

    Now let's look into the csproj, in the csproj of .NET Core, we can include all the source files with wildcard although we must include all the source files separately in the original csproj of .NET Framework.

    &lt;ItemGroup&gt;
        &lt;Compile Include="**\*.cs" /&gt;
        &lt;EmbeddedResource Include="**\*.resx" /&gt;
      &lt;/ItemGroup&gt;

    Next, if you add NuGet library to your project, you have to add ItemGroup/PackageReference element. Then execute "dotnet restore" command.

    &lt;ItemGroup&gt;
        &lt;PackageReference Include="NewtonSoft.Json"&gt;
          &lt;Version&gt;9.0.1&lt;/Version&gt;
        &lt;/PackageReference&gt;
      &lt;/ItemGroup&gt;

    Migrate project.json

    If you have project.json style project, you can migrate it to csproj and only have to execute the "dotnet migrate" command. This command converts without confirmation, but you can restore the original project.json file under backup directory.

    $ ls
    Program.cs  project.json
    $ dotnet migrate
    Project Migrate migration succeeded (/tmp/Migrate)
    Summary
    Total Projects: 1
    Succeeded Projects: 1
    Failed Projects: 0
    
    $ ls *
    Migrate.csproj  Program.cs
    
    backup:
    project.json

    Visual Studio Code Support

    Visual Studio Code C# extension now supports csproj file. This is the initial support and I'm looking forward to more features like intelisense support in csproj.

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

    Takayoshi Tanaka

    About the author:

    Takayoshi Tanaka is a Software Maintenance Engineer at Red Hat. He is mainly in charge of OpenShift, .NET Core on Red Hat Enterprise Linux and Red Hat solutions on Microsoft Azure. He is a Microsoft MVP for Visual Studio and Development Technologies. He writes many articles in his personal blog and web sites, and also provides many technical sessions at community events.

    Last updated: March 22, 2023

    Recent Posts

    • Deploy MemPalace MCP Server on Red Hat OpenShift AI

    • Get ready for Ansible Automation Platform 2.7

    • Manage LLM evaluation workloads at scale with EvalHub and Kueue

    • Troubleshoot application misbehavior after an OpenShift upgrade

    • Preserve OpenShift Pipelines logs with OpenTelemetry

    What’s up next?

     

    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.