How to publish ASP.NET Core from visual studio 2022 as Self-Contained?

Here is instruction how to publish ASP.NET core with self contained (i.e. where all the assemblies are included) from  Visual Studio 2022?

1) Start Visual Studio 2022.
2) Click ‘Create a new project’.
3) In ‘Create a new project' window, select ASP.NET Core Web App or search it manually, then click on ‘Next’ button.
 
 
4) In the next window, type a project name and click ‘Next’.
 
 
5) In the next window, choose Framework version and Authentication type. After that, click ‘Create’ button.
 
 
6) Open the 'Publish' settings in your project by right clicking on it in the Solution Explorer window and then selecting it.
 
 
7) Choose Import Profile and click the ‘Next’ button.
 
 
8) Select the publish settings file and click ‘Finish’. 
 
 
9) Click ‘Show all settings’, validate the connection with our web deploy server and Make sure do not click on 'save' button.
 
 
10) And click 'Next' or 'Settings' button to update the 'Deployment Mode' to 'Self-Contained' and 'Target Runtime' to 'win-x86'.
 
 
Now, you can deploy your solution to the destination platform of your choice without the need for certain assemblies to be installed on the server to support a particular .NET Core version.
 
Note: A Self-Contained ASP.NET Core application does require more memory to run because it is loading all the assemblies required by the version.  You can reduce the memory usage by changing the garbage collection mode from server to workstation.  Just add the <ServerGarbageCollection> XML markup to the ASPNETCore.csproj file and set it to "false".
 
<PropertyGroup> 
  <ServerGarbageCollection>false</ServerGarbageCollection>
</PropertyGroup>
 
 
 
  • Asp.Net core, core, visual studio
  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

How to turn off dotnet app by using the App Offline file app_offline.htm?

However,  dotnet application is loading .dll/.exe files in an individual process to run the...

how to create simple webscoket in ASP.NET with SignalR?

1.) Create "ASP.NET Core Web App (C#)" in Visual Studio 2.) Add the SignalR client library In...

How to fix HTTP Error 404 when download static file in ASP.NET core?

You may get an HTTP Error 404 when browsing/downloading a static file like .Apk when the client...

How to Use IdentityServer in ASP.NET Core with Certificate Signing?

Creating and Adding the Certificate To create and add a certificate to your machine's...

Powered by WHMCompleteSolution