This is the right place to ask question related to AlrterNET products, including technical aspects, license and installation-related issues.
The questions answered may benefit other members of AlterNET community as they will be able to search for already existing solution.
Alternatively you may choose to contact us at instead.
Finally I managed to make a small program with SyntaxEdit, TextSource, CsParser and ScriptRun. I used RegisterDefaultAssemblies, RegisterCodeFiles, RegisterAssembly, ScriptAssemblyKind.DynamicLibrary, GlobalItems.Add, and RunMethodAsync. Everything works well except for one thing: In the SystaxEdit control the word "ScriptGlobalClass" is highlighted as an error, while the script runs normally without errors. It seems that this word is not registered in my code?? I have looked in all examples, but I could not find how to solve this issue and remove this wrong syntax error highlighting.
Another question/feature request, would it be possible to remove the need to use this "ScriptGlobalClass" in the future?
I solved it by digging deeper into the source code of the Scripter ObjectReference example. In RegisterScriptCodeForEditor() a piece of cs-code is generated "global.cs" which does the trick:
public static class ScriptGlobalClass
public static ;
// etc.
When this file is included in the VS-project then SyntaxEdit instance displays "ScriptGlobalClass" and the global items correctly. This file does not declare a namespace. Also the assembly must have been registered with csParser.Repository.RegisterAssembly();
Still not solved:
Without my own declared static ScriptGlobalClass the syntax editor shows the error: "The name 'ScriptglobalClass' does not exist in the current context.
With my own declared static ScriptGlobalClass the syntax editor does not show this error, but then ScriptRun.Compile() returns a warning CS0436: "The type 'ScriptGlobalClass' in '*' conflicts with the imported type 'ScriptGlobalClass' in '' ... Using the type defined in '*'."
Note that '*' is actually empty: I can not find the assembly where the original ScriptGlobalClass is defined. I know that this question is not in the right place because I did not generate a new topic. However, any help is really appreciated.
You should not incude ScriptGlobalClass into the project and call RegisterAssembly as it causes to ambiguity between ScriptGlobalClass added through RegisterAssembly and ScriptGlobalClass added through RegisterCode.
Code in the RegisterScriptCodeForEditor will be enough or you can directly register it like this:
csParser1.Repository.AddDocument("global.cs", code);
Please have a look at the slightly modified ObjectReference demo: