Deploying ASP.NET Websites
There are essentially two options for deploying ASP.NET websites created with Oxygene or Swift to a server: Installing the Elements compiler on the server, or deploying the website as pre-compiled .dll(s).
Installing Elements On the Server
If you simply upload your website to the server and try to access it, you will most likely be greeted by an error message stating that "'Oxygene' is not a supported language" or "'Silver' is not a supported language".
This is somewhat expected, as a copy of the Elements compiler is required on the server in order to compile the .pas or .swift files and the snippets inside your .aspx files, as needed. There are two ways to achieve this:
Running the Elements Compiler Setup
If your ISP gives you the ability to run and install custom software, the easiest and quickest way to get Oxygene installed is to use the Oxygene installer and uncheck all options. This will install all the binaries required to use Oxygene or Swift with ASP.NET, and it will register the Elements compiler with the global machine.config
file so that ASP.NET can find it.
After installation, your Oxygene- or Swift-based ASP.NET website should "just work".
Deploying the Elements Compiler as Part of Your Website
Alternatively, you can also upload the Elements compiler to your web space as part of your website. This comes in handy when using an ISP that does not let you run custom installers, for example when using a shared server. This method of deployment can also be helpful if you want to use different versions of the compiler for different websites on the same server (for example to test a new version of your site, which might leverage newer features, without affecting other sites on the same server).
You can even combine the two deployment methods — install a global copy of the compiler using the command line installer, which will be used by default, and configure individual websites to use a different version, deployed as part of the individual site.
There are two simple steps involved in deploying the Elements compiler as part of your website:
One, deploy the following .dll files (which can be found in the
.\Bin
folder of your local Elements install) to the ./Bin
folder of
your .ASP.NET web site:
RemObjects.Oxygene.dll
RemObjects.Oxygene.AspAppDomainHelper.dll
RemObjects.Oxygene.Code.dll
RemObjects.Oxygene.Echoes.dll
RemObjects.Oxygene.Tools.dll
RemObjects.Elements.Cirrus.dll
-
Echoes.dll
— Only on .NET 4.0, and only required if you use types.
These .dlls would simply go next to any custom or third-party assemblies your website might already be using.
Two, add the following compiler
section to your Web.config
file
in the root of your web site, where you replace "1.0.0.0
" with the exact
version of Elements you are deploying (for example "8.0.81.1667
", for the
December 2014 release). If you don't have a
Web.config
file yet, you can create a new one with full snippet below:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.codedom>
<compilers>
<compiler language="Oxygene"
extension=".pas"
type="RemObjects.Oxygene.CodeDom.OxygeneCodeProvider, RemObjects.Oxygene.Tools, Version=1.0.0.0, Culture=neutral, PublicKeyToken=3df3cad1b7aa5098" />
<compiler language="Silver"
extension=".swift"
type="RemObjects.Elements.CodeDom.SilverCodeProvider, RemObjects.Oxygene.Tools, Version=1.0.0.0, Culture=neutral, PublicKeyToken=3df3cad1b7aa5098" />
</compilers>
</system.codedom>
</configuration>
Pre-Compiled Deployment
Another way to deploy your project is precompiled into .dlls. Because all the compilation happens on your development machine and no .pas files will need to be updated on the server, this option does not require the compiler to be present on the server machine at all. You can simply upload your .dlls, and your website is good to go.