Create a Self-contained package for Build and Deployment in CI-CD pipelines- Guidelines

Self contained package for Build and Deployment in CI CD pipelines

Today in this article, we shall cover how to create a self-contained package for Build and Deployment in CI-CD pipelines on Windows Server or on a Cloud environment.

You may decide to opt for deployment depending on the requirement like whether you need to install the framework required.

Publishing an app as self-contained includes the .NET runtime and users of the app don’t have to worry about installing .NET before running the app.

If you have a.NET application, please use any of the below commands as suitable and create the deployable as self-contained, which later can be deployed to the target server.

For Linux

dotnet publish -r linux-x64 --self-contained true -c Release  

For Windows10

dotnet publish -r win10-x64 --self-contained true -c Release  

In the above example,

  • -r  This switch indicates an identifier (RID) to specify the target platform.
  • --self-contained true This switch indicates the .NET Core SDK to create an executable as a self-content.

For Windows Server

dotnet publish -r win-x64 --self-contained true -c Release  

Note: Command ‘-self-contained true‘ will create self-contained large exe with all required runtime binaries related to .NET Core runtime. This also mean your dont need .NET Core runtime or SDK installed on the target server as your exe is now self contained and can run on its own.

Below are a few common list runtime identifiers for your reference,

  • Portable
    • win-x64
    • win-x86
    • win-arm
    • win-arm64

  • Windows 7 / Windows Server 2008 R2
    • win7-x64
    • win7-x86

  • Windows 8.1 / Windows Server 2012 R2
    • win81-x64
    • win81-x86
    • win81-arm

  • Windows 10 / Windows Server 2016
    • win10-x64
    • win10-x86
    • win10-arm
    • win10-arm64

for Linux and macOS RID, please visit here for more details.

References :

Do you have any comments or ideas or any better suggestions to share?

Please sound off your comments below.

Happy Coding !!



Please bookmark this page and share it with your friends. Please Subscribe to the blog to receive notifications on freshly published(2024) best practices and guidelines for software design and development.



Leave a Reply

Your email address will not be published. Required fields are marked *