<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Abubakar Siddiq</title>
    <description>The latest articles on DEV Community by Abubakar Siddiq (@abubakarsiddiq).</description>
    <link>https://dev.to/abubakarsiddiq</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F203193%2F24868847-df7a-450d-a32c-8f34f0183b17.jpeg</url>
      <title>DEV Community: Abubakar Siddiq</title>
      <link>https://dev.to/abubakarsiddiq</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/abubakarsiddiq"/>
    <language>en</language>
    <item>
      <title>Create .NET Core 3.0 trimmed self-contained single executable app using VS Code</title>
      <dc:creator>Abubakar Siddiq</dc:creator>
      <pubDate>Wed, 31 Jul 2019 08:09:00 +0000</pubDate>
      <link>https://dev.to/abubakarsiddiq/create-net-core-3-0-trimmed-self-contained-single-executable-app-using-vs-code-3jmf</link>
      <guid>https://dev.to/abubakarsiddiq/create-net-core-3-0-trimmed-self-contained-single-executable-app-using-vs-code-3jmf</guid>
      <description>&lt;p&gt;In this tutorial, we are going to learn how to create a Asp.NET Core 3.0 trimmed self-contained app using visual studio code. In this way we can share our application without installing .NET SDK on the target machine. So, first-of-all, we will create an Asp.Net Core 3.0 app, then we will publish it as self-contained app and then we will see how to reduce the files using PublishSingleFile flag and then we will see how to reduce the size of executable using PublishTrimmed flag which is a new feature of .NET Core 3.0 Preview 6.&lt;/p&gt;

&lt;h2&gt;
  
  
  Prerequisite of this tutorial
&lt;/h2&gt;

&lt;p&gt;Before going to the next, you must have installed these below prerequisites.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Visual Studio Code&lt;/li&gt;
&lt;li&gt;.NET Core 3.0 Preview 6&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  How to create a .NET Core 3.0 trimmed self-contained single executable app using VS Code?
&lt;/h2&gt;

&lt;p&gt;Let’s see how to create a .NET Core 3.0 trimmed self-contained single executable app using VS Code in step by step.&lt;/p&gt;

&lt;h1&gt;
  
  
  Step # 1: Create an Asp.Net Core 3.0 app using VS Code.
&lt;/h1&gt;

&lt;p&gt;So, first-of-all, in this step we will create an Asp.Net Core app using Visual Studio code. So, open Visual Studio code, then open command terminal and then choose directory where you want to create your project and then run this below &lt;br&gt;
command.&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;&lt;code&gt;dotnet new mvc&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;After running the above command, you will see a new “Asp.Net Core web App (Model-View-Controller)” project is created.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--hM6COaVz--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/opz0arxariffhelgz3u7.JPG" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--hM6COaVz--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/opz0arxariffhelgz3u7.JPG" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now, run this project by running this below command.&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;&lt;code&gt;dotnet run&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;Now, you will see the output as you do see in the below screenshot.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Tns4pRAV--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/cbh75i33x6p5a37kw9sd.JPG" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Tns4pRAV--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/cbh75i33x6p5a37kw9sd.JPG" alt=""&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h1&gt;
  
  
  Step # 2: How to publish self-contained app?
&lt;/h1&gt;

&lt;p&gt;Now, in this step, we will see how to publish the self-contained app. So, go to terminal and run this below command.&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;&lt;code&gt;dotnet publish -r win10-x64 -c Release --self-contained&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;So, the above command will build the app in release mode and will publish the self contained app. It will create a new folder with the name of publish which will have lots of files with the .exe file. So, now we can run this app on any other machine. We just need to copy the complete folder and paste in any other machine. Then finally, run the .exe file.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--C_PvpsDj--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/0ksa96g3dmp08skqomff.JPG" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--C_PvpsDj--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/0ksa96g3dmp08skqomff.JPG" alt=""&gt;&lt;/a&gt;&lt;br&gt;
So, we have publish folder with lots of files and the size is also huge as you see below screenshot. So, the question is, how can we reduce the files and the size? Let’s see in the next step.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--_m_IPMiz--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/dkweqov70eh233zvihcg.JPG" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--_m_IPMiz--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/dkweqov70eh233zvihcg.JPG" alt=""&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h1&gt;
  
  
  Step # 3: How to Reduce the files in self-contained app?
&lt;/h1&gt;

&lt;p&gt;In this step, we will see how to reduce the files in self-contained app. So, according to .NET Core 3.0 Preview 5, we can publish a single-file executable using PublishSingleFile flag. Let’s see how it works.&lt;/p&gt;

&lt;p&gt;Now, run this below command.&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;&lt;code&gt;dotnet publish -r win10-x64 -c Release /p:PublishSingleFile=true&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;Now, you will see the output as you do see in the below screenshot.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--f4Tgna-t--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/kq67tu1kibmbdxyt9nxj.JPG" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--f4Tgna-t--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/kq67tu1kibmbdxyt9nxj.JPG" alt=""&gt;&lt;/a&gt;&lt;br&gt;
So, as you see the above we have reduced our files. There is only one .exe file with web.config file. But, the problem of size is still the same as you see in the below screenshot.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--djEmjqsC--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/yhl8iyiap59xb0uky0oi.JPG" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--djEmjqsC--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/yhl8iyiap59xb0uky0oi.JPG" alt=""&gt;&lt;/a&gt;&lt;br&gt;
Let’s see how to reduce the size.&lt;/p&gt;
&lt;h1&gt;
  
  
  Step # 4 : How to reduce the size of self-contained app?
&lt;/h1&gt;

&lt;p&gt;In this step, we will see how to reduce the size of self-contained app. So, according to .NET Core 3.0 Preview 6, we can reduce the size of self-contained app using PublishTrimmed flag. Let’s see how it works.&lt;/p&gt;

&lt;p&gt;Now, run this below command and publish self-contained app.&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;&lt;code&gt;dotnet publish -r win10-x64 -c Release /p:PublishSingleFile=true /p:PublishTrimmed=true&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;Now, you will see, the above command will give you the output as you do see in the below screenshot.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--bUaUVxJS--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/jcjvas070f3ihy4mjjwa.JPG" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--bUaUVxJS--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/jcjvas070f3ihy4mjjwa.JPG" alt=""&gt;&lt;/a&gt;&lt;br&gt;
Thank you for reading. Please keep visiting and sharing it within your community.&lt;br&gt;
You can read more about application deployment here in below links:&lt;br&gt;
&lt;a href="http://dotnetdetail.net/how-to-deploy-angular-6-and-asp-net-core-application-in-iis-8/"&gt;How to deploy Angular 6 and Asp Net Core Application in IIS 8?&lt;/a&gt;&lt;br&gt;
&lt;a href="http://dotnetdetail.net/how-to-deploy-angular-6-asp-net-core-app-to-azure-using-visual-studio/"&gt;How to deploy Angular 6 &amp;amp; Asp Net Core App to Azure using Visual Studio&lt;/a&gt;&lt;br&gt;
&lt;a href="http://dotnetdetail.net/continuous-integration-and-continuous-deployment-in-devops-using-visual-studio-2019/"&gt;Continuous Integration and Continuous Deployment in DevOps using Visual Studio 2019&lt;/a&gt;&lt;/p&gt;

</description>
      <category>dotnet</category>
      <category>csharp</category>
      <category>webdev</category>
    </item>
  </channel>
</rss>
