Categories

Roslyn compiler

Enabling and disabling Roslyn

To enable Roslyn compiler you need to edit the appsettings.json file. 

//For developers - more info you can find at https://docs.microsoft.com/en-us/dotnet/csharp/roslyn-sdk/
//https://github.com/dotnet/roslyn/wiki/Roslyn-Overview
"UseRoslynScripts": false,

Roslyn compilation screen

To enable it, you need to change the "UseRoslynScripts" from False to True. To apply changes, you need to restart the application.

To disable it, you need to change the "UseRoslynScripts" from True to False. And as before, you need to restart the application to apply the changes.

How to upload new Roslyn scripts?

In GrandNode you will find a new directory which contain all files related with Roslyn - it's called Roslyn. You will find it in main directory of GrandNode. 

Roslyn file structure

Roslyn directory

In standard version of GrandNode, this folder will contain two Roslyn scripts (csx files). First is responsible for zip code validation, second for adding a new message template token.

If you create a new Roslyn script, you need to upload it to mentioned earlier directory. After that, please restart the application. If Roslyn is enabled, you will find it in admin panel. 

Roslyn enabled

If everything is correct, you will see a tick in the "Is compiled successfully" column. It means that you can use this script and it's working. You won't see a tick in this column, if your script will have errors. You will see errors in the last column. As it's shown below:

Roslyn errors

You need to remember that scripts are compiling during restart, so each time you modify them, you need to restart the application.

back to top