Skip to main content

Getting Started with C# Hosting

Deploy your C# (.NET) applications on ShardCloud with minimal configuration and maximum performance.
ShardCloud supports .NET applications with automatic build and execution via dotnet run or direct .dll execution.

Prerequisites

Before uploading your C# application, ensure you have the following project structure ready.

Required Files

Essential files for deployment

Excluded Files

Files to exclude before upload

Required Files

Your C# application must include these essential files:

1. Project or Entry Point File

You can deploy using one of these options:
MAIN ValueExecution CommandUse Case
MyApp.csprojdotnet run --project MyApp.csprojUpload source code, platform builds and runs
MyApp.dlldotnet MyApp.dllUpload pre-built DLL
auto or emptyAuto-detect .dll in bin/ folderLet platform find your DLL
(omitted)dotnet runRun from project root

2. ShardCloud Configuration

  • File: .shardcloud
  • Purpose: Platform-specific deployment settings
  • Requirements: Plain text configuration file in root directory
The .shardcloud file is required. Missing this file will prevent successful deployment.

Deployment Options

Upload your source code with the .csproj file and let ShardCloud build and run it automatically. Required files:
  • *.cs source files
  • YourApp.csproj
  • .shardcloud
Files to exclude:
  • bin/
  • obj/
  • .vs/
  • *.user

Option 2: Upload Pre-built DLL

Upload your compiled application directly. Required files:
  • YourApp.dll (and dependencies)
  • .shardcloud

ShardCloud Configuration

The .shardcloud file configures your application deployment settings.

Configuration Example (Source Code)

DISPLAY_NAME=myfirstcsharpproject
DESCRIPTION=a simple C# application
MAIN=MyApp.csproj
MEMORY=1024
VERSION=recommended

Configuration Example (Pre-built DLL)

DISPLAY_NAME=myfirstcsharpproject
DESCRIPTION=a simple C# application
MAIN=MyApp.dll
MEMORY=1024
VERSION=recommended
.NET applications typically require more memory than interpreted languages. Choose appropriate memory allocation for your application’s needs.

Deployment Process

1

Prepare Application

Ensure your project compiles locally with dotnet build
2

Create Configuration

Create .shardcloud file with deployment settings
3

Exclude Unnecessary Files

Remove bin/, obj/, and .vs/ folders (if uploading source)
4

Create Archive

Zip or RAR your project
5

Upload via Dashboard

Use ShardCloud dashboard to upload your archive
6

Deploy & Monitor

Application automatically builds (if needed) and runs

Common Configuration Examples

ASP.NET Core Web API

DISPLAY_NAME=aspnet-api
DESCRIPTION=REST API with ASP.NET Core
MAIN=MyApi.csproj
MEMORY=1024
VERSION=recommended
SUBDOMAIN=aspnetapi

Console Application

DISPLAY_NAME=dotnet-worker
DESCRIPTION=Background worker service
MAIN=Worker.csproj
MEMORY=512
VERSION=recommended

Pre-built Application

DISPLAY_NAME=dotnet-app
DESCRIPTION=Pre-compiled .NET application
MAIN=MyApp.dll
MEMORY=512
VERSION=recommended