{"id":12303,"date":"2025-05-12T10:32:18","date_gmt":"2025-05-12T10:32:18","guid":{"rendered":"https:\/\/www.bacancytechnology.com\/qanda\/?p=12303"},"modified":"2025-05-12T10:32:18","modified_gmt":"2025-05-12T10:32:18","slug":"publish-net-core-application-on-linux","status":"publish","type":"post","link":"https:\/\/www.bacancytechnology.com\/qanda\/dot-net\/publish-net-core-application-on-linux","title":{"rendered":"Publishing .Net Core Application in Linux"},"content":{"rendered":"<h2>Prerequisites<\/h2>\n<p>Before publishing your .NET Core 5 application on a Linux machine, ensure the following requirements:<\/p>\n<p><strong>1. Install .NET Core SDK:<\/strong> Verify that the correct version of the .NET Core 5 SDK is installed.<\/p>\n<ul>\n<li>Use the following command to check the installed version:<br \/>\ndotnet &#8211;version<\/li>\n<li>To install the .NET Core 5 SDK, follow the official <a href=\"https:\/\/dotnet.microsoft.com\/download\/dotnet\/5.0\" target=\"_blank\" rel=\"noopener\">Microsoft documentation<\/a>.<\/li>\n<\/ul>\n<p><strong>2. Verify Dependencies:<\/strong><\/p>\n<ul>\n<li>Ensure essential dependencies like libicu, libcurl, and libssl are installed.<\/li>\n<\/ul>\n<p>-> On Ubuntu-based distributions, install these dependencies with:<br \/>\nsudo apt update<\/p>\n<ul>\n<li>sudo apt install libicu libcurl4 libssl1.1<\/li>\n<\/ul>\n<h2>Publish the Application<\/h2>\n<ol>\n<li><strong>Navigate to Project Directory:<\/strong><br \/>\ncd \/path\/to\/your\/project<\/li>\n<li><strong>Restore Dependencies:<\/strong> Ensure the dotnet restore command completes without errors before publishing:<br \/>\ndotnet restore<br \/>\nIf you encounter issues during restore, check the nuget.config file and verify the package sources are reachable.<\/li>\n<li><strong>Publish the Application:<\/strong> Use the following command to publish your application:<br \/>\ndotnet publish AppName.sln -c Release -o \/path\/to\/output<br \/>\n<code>-c Release: Specifies the build configuration.<br \/>\n-o \/path\/to\/output: Specifies the output directory<\/code>.<\/li>\n<li><strong>Troubleshooting Stuck Restore Process:<\/strong><br \/>\n&#8211; Clear NuGet cache:<br \/>\n&#8211; dotnet nuget locals all &#8211;clear<br \/>\n&#8211; Check network connectivity and proxy settings.<br \/>\n&#8211; Run the command with &#8211;verbosity detailed to get more information:<br \/>\ndotnet restore &#8211;verbosity detailed<\/li>\n<\/ol>\n<h2>Run the Application<\/h2>\n<p>Once the application is published, navigate to the output directory and run the application:<\/p>\n<p><code>cd \/path\/to\/output<br \/>\n.\/AppName<\/code><br \/>\nIf the application does not start, check the execution permissions:<br \/>\n<code>chmod +x AppName<\/code><\/p>\n<div class=\"qanda-read-box\"><div class=\"bg-light read-more-icon\"><img decoding=\"async\" src=\"https:\/\/assets.bacancytechnology.com\/qanda\/wp-content\/uploads\/2025\/04\/24061434\/read-txt.png\" alt=\"Also Read\"><p><\/p><h3>Also Read:<\/h3><a href=\"https:\/\/www.bacancytechnology.com\/blog\/web-api-in-net-6\" target=\"_blank\">Web API in .NET 6<\/a><\/div><\/div>\n<h2>Logs and Diagnostics<\/h2>\n<p>Enable detailed logging with the following environment variable:<br \/>\nexport<br \/>\n<code>DOTNET_CLI_TELEMETRY_OPTOUT=1<\/code><\/p>\n<ul>\n<li>export DOTNET_SYSTEM_GLOBALIZATION_INVARIANT=1<\/li>\n<li>Check logs in the system journal (for system services):<br \/>\njournalctl -xe<\/li>\n<\/ul>\n<h2>Conclusion<\/h2>\n<p>Following these steps, you can publish and run your .NET Core 5 application on a Linux machine. If issues persist, verify system dependencies, network connectivity, and environment configurations.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Prerequisites Before publishing your .NET Core 5 application on a Linux machine, ensure the following requirements: 1. Install .NET Core SDK: Verify that the correct version of the .NET Core 5 SDK is installed. Use the following command to check the installed version: dotnet &#8211;version To install the .NET Core 5 SDK, follow the official [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":12304,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"inline_featured_image":false,"footnotes":""},"categories":[20],"tags":[],"class_list":["post-12303","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-dot-net"],"acf":[],"_links":{"self":[{"href":"https:\/\/www.bacancytechnology.com\/qanda\/wp-json\/wp\/v2\/posts\/12303"}],"collection":[{"href":"https:\/\/www.bacancytechnology.com\/qanda\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.bacancytechnology.com\/qanda\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.bacancytechnology.com\/qanda\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.bacancytechnology.com\/qanda\/wp-json\/wp\/v2\/comments?post=12303"}],"version-history":[{"count":2,"href":"https:\/\/www.bacancytechnology.com\/qanda\/wp-json\/wp\/v2\/posts\/12303\/revisions"}],"predecessor-version":[{"id":12363,"href":"https:\/\/www.bacancytechnology.com\/qanda\/wp-json\/wp\/v2\/posts\/12303\/revisions\/12363"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.bacancytechnology.com\/qanda\/wp-json\/wp\/v2\/media\/12304"}],"wp:attachment":[{"href":"https:\/\/www.bacancytechnology.com\/qanda\/wp-json\/wp\/v2\/media?parent=12303"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.bacancytechnology.com\/qanda\/wp-json\/wp\/v2\/categories?post=12303"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.bacancytechnology.com\/qanda\/wp-json\/wp\/v2\/tags?post=12303"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}