SCD

In this type of deployment model, .NET Core is also deployed along with your application and dependency libraries. Thus, the size of your deployment package becomes large when compared to the package created by the FDD model. The version of .NET Core depends on the version of the framework that you build your app with.

In this model, the output of the .NET Core application is an .exe file, which loads the actual .dll file on execution.

The main advantages of this type of deployment are as follows:

  • As you are bundling the version of .NET Core that your app needs to run, you can be assured that it will run on the target system.
  • Only you can decide which version of .NET Core your app will support. You should select the target platform before you create the deployment package.
  • The output is an EXE file, which loads the actual DLL.

Let's follow these steps to create, build, run, and publish an app using the SCD model:

  1. Create a directory for your solution (for example, DotNetCore) and navigate to it in a command window.
  2. Enter the following command to create a new C# console application:
dotnet new console -lang C# -n "SCD Demo"
  1. Create a solution file named SCD Demo and add the project to the solution file:
> dotnet new sln -n "SCD Demo"
> dotnet sln "SCD Demo.sln" add "SCD DemoSCD Demo.csproj" 
  1. Now, open the SCD Demo.csproj project file in a notepad.
  2. Create a <RuntimeIdentifiers> tag under the <PropertyGroup> section of your .csproj project file and define the platforms that your app targets:
<PropertyGroup> 
  <RuntimeIdentifiers>win10-x64</RuntimeIdentifiers> 
</PropertyGroup> 
  1. Here, you can also set multiple identifiers separated by semicolons.
  2. Now, resolve the dependencies by entering the following command:
dotnet restore
  1. Build the solution by running the following command (enter the runtime identifier that you want your app to target), which will generate the output of the application in the binDebug etcoreapp1.0 folder:
dotnet build -r win10-x64
  1. If the build succeeds, then the output DLL will be generated along with the .exe file as DotNetCoreSCD DemoinDebug etcoreapp1.0SCD Demo.dll and DotNetCoreSCD DemoinDebug etcoreapp1.0SCD Demo.exe.
  2. Now, enter the following command to run it:
dotnet "SCD DemoinDebug
etcoreapp1.0SCD Demo.dll"
  1. You can also run the .exe file directly:
"SCD DemoinDebug
etcoreapp1.0SCD Demo.exe"
  1. Once you are ready to publish your app, enter the following command to create the release version of the project to the DotNetCoreSCD DemoinRelease etcoreapp1.0win10-x64publish folder:
dotnet publish -c Release -r win10-x64

If you open the published folder, then you will see many other files apart from the project DLL, project EXE, JSON configurations, and PDB files. You can create as many deployment packages as you want based on your targeted runtime identifiers (RIDs). Separate folders will be generated for each RID package.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.144.84.155