Intellisense for C#Scripts (CSX) in Visual Studio Code

I developing for a while some scripts for a customer in csx. These will be used for e.g in Azure Function Apps.
To code small pieces of processes in a logic app.

 

From this moment, I feel like the young developer in times without intellisense. So it is hard to code fast the solutions.┬áBecause you get only a webeditor with a “save & run” button. After clicking this button, you will get an error and so on. But this way does not work when you want a CI / CD Build.

Intellisense

First of all I wan’t to increase the coolnes factor with intellisense, for this I assume you have already installed Visual Studio Code (the small and free one).
Now you must install the Omnisharp extension. After installing it, you will see (after a restart) that nothing will happen. Sadly faces…

Nothing happens

You’ll need to create a File named “project.json” and it must contains an empty Json “{}” in it. After you save the file, the magic happens. Omnisharp will be started up in the background and wan’t to parse all files to get the full intellisense. But there you don’t get any intellisense for now.
So this is a known “feature” because ths support CSX files was not in the actual stable Version of omnisharp. Sadly face again….

So you must install a beta Version from omnisharp, I use the Beta 18. When you download it. After extracting the contents  set the omnisharp path to the extracted directory.
Let’s assume you have the content extracted in “D:\omnisharp”, then you must set the user preference (F1 -> “open user settings”), to use the new path. In my example it looks like the following:

So now you must restart the IDE. After doing this you will se in the log console, that Omnisharp begin to work and start making the wonder happen. But then I saw in the log some errors like the following:

This indicates, that omnisharp didn’t find the thrid party assembly that you use. In this example the “antlr4.stringtemplate.dll”. To solve ths Problem you must insert the Assembly into the .net folder. This must be done for all custom assemblies that you will use. I know, that’s not a good way and I hope that Omnisharp will get an setting for this (or search the GAC for this). But when we now restart the IDE again. You will get the Intellisense work. Happy Face!!!