Package code
Package your C# code into compression files before you deploy as a live Cloud Code module.
Read time 3 minutesLast updated a day ago
The package code workflow. Use `.NET` to produce assemblies for your C# project, then compress the assemblies as `.zip` files or `.ccm` files before you deploy as a live Cloud Code module.
- Deploying using the UGS CLI requires you to package your code into a .ccm file.
- Deploying using Cloud Code Admin API accepts either a .ccm file or a .zip file.
Ready to Run (R2R) compilation
You can enable Ready to Run compilation when producing assembles for your module project. This can slightly improve the cold start time for your module, but it won't improve the response time after the first call. The option also increases the size of the assemblies. Check Microsoft documentation on ReadyToRun Compilation for further details.Producing assemblies
To produce assemblies in this format, use the .NET command-line interface (CLI) or an IDE such as JetBrains Rider or Microsoft Visual Studio as described in the sections below. You must produce assemblies only for the main module project that contains your Cloud Code module endpoints.Using the .NET command-line interface
To produce assemblies with the .NET CLI, use thedotnet publishYou can specify the target platform and R2R compilation in the project by adding thedotnet publish -c Release -r linux-x64 -p:PublishReadyToRun=true
<PublishReadyToRun>Publish the module using the following command:<PropertyGroup><PublishReadyToRun>true</PublishReadyToRun></PropertyGroup>
By default, this produces assembles in thedotnet publish -c Release -r linux-x64
bin/Release/net8.0/linux-x64/publishUsing Microsoft Visual Studio
You can produce assemblies with Microsoft Visual Studio. To do so, follow these steps:- Right-click the C# project for the module and select Publish from the menu.
- Do the following on the Publish page:
- Select Folder as target and then Next.
- Select Folder as specific target and then Next.
- Select Finish.
- On the Publish profile creation progress page, select Close.
- In the Publish window's Publish tab, select Show all settings.
- Make sure that the target runtime is .
linux-x64 - (Optional) Make sure that PublishReadyToRun is activated.
- Select Publish
Using JetBrains Rider
You can produce assemblies with JetBrains Rider. To do so, follow these steps:- Open Run > Edit Configurations..., or select Edit Configurations from the navigation bar.
- Select + > Add New Configuration.
- Choose the Publish to folder configuration type.
- Set Target runtime to .
linux-x64 - (Optional) Activate Enable ReadyToRun compilation.
- Select Apply to save the configuration.
- When you are ready to publish your module, select the run configuration you created on the toolbar, then Run.
Packaging the assemblies
After producing these assemblies, compress them in an archive. If you plan to deploy using the UGS CLI, you can set the archive extension to .ccm.
The structure of the archive should look like this:
By default, this will include the dependencies of Cloud Code NuGet packages.MyModule.ccm├─ MyModule.dll├─ MyModule.deps.json├─ Dependency1.dll├─ Dependency2.dll└─ ...
You can then deploy the archive using the UGS CLI or the Cloud Code Admin API.