You can deploy Kentico web projects to your hosting server using the Visual Studio Publish function (opens in a new tab) (MSDeploy).
Visual Studio publishes the project according to your profile's settings – either copies the project's files to the target server or creates a deployment package.
When deploying websites from Visual Studio, you have the option of precompiling (opens in a new tab) the web project before you place it on a server. This compiles the project's code into assemblies, providing several advantages:
Limitations of precompiled websites
Only use precompilation to deploy completed websites. Precompiled instances of Kentico have limited website development features.
You cannot edit, create or import virtual objects that contain ASP.NET markup and require compilation:
If you wish to import physical files that require compilation (such as cs, vb, aspx, ascx), you need to run the import process on the original project, and then create the precompiled site again.
Partial caching (i.e. caching portions of page output generated by specific web parts or controls) is not supported on precompiled websites.
You can check that your site's virtual objects (Transformations, Page layouts, etc.) compile correctly before starting the precompilation.
The system compiles all virtual objects and adds them to the temporary files in the application's ASP.NET cache. This operation may take a long time, depending on the number of virtual objects in the system.
If the process finishes without errors, your website should run correctly after the precompilation.
Before you start the deployment, you need to perform the following steps to include your website's virtual objects into the precompiled project:
The system creates physical files containing the code of your virtual objects inside the project's CMSVirtualFiles folder.
Note: On web application projects, you need to manually include the CMSVirtualFiles folder into the CMSApp project. See Deployment mode for virtual objects for details.
When creating a publish profile (opens in a new tab) for your Visual Studio deployment, configure the following precompilation options in the Publish Web dialog:
On the Settings tab, expand File Publish Options and enable Precompile during publishing.
Click Configure next to the Precompile during publishing check box.
Configure the options in the Advanced Precompile Settings dialog:
Allow precompiled site to be updatable:
Merge options - select one of the following options:
Do not merge
Do not merge. Create a separate assembly for each page and control
Do NOT select any of the other options. Merging of outputs into assemblies is not supported by Kentico projects.
After you finish setting up the profile's remaining settings, you can Publish the precompiled site.
Tip: You can also use the ASP.NET Compilation Tool (opens in a new tab) to perform the precompilation from the command line.
Precompiled Kentico sites cannot be used to install a new SQL database on the target server. If you need to move the database as part of the deployment process, you have several options: