add file system file reference (.cs) to SyntaxEditor

SyntaxEditor for Windows Forms Forum

Posted 1 year ago by Mark
Avatar

Hi

I'm trying to add an external reference (.cs file) to my "SyntaxEditor" (c#) project.

How can I do?

Thanks in advance

private ActiproSoftware.Text.Languages.DotNet.Reflection.IProjectAssembly projectAssembly;
projectAssembly = new ActiproSoftware.Text.Languages.CSharp.Implementation.CSharpProjectAssembly("SdiCodeEditor");

//OK, work
projectAssembly.AssemblyReferences.Add(Assembly.Load("myDLLReference"));

//KO, not work
//?????????????????
projectAssembly.SourceFiles.Add("c:/temp/file.cs");
//?????????????????
//file.cs types are not loaded by the intellisense

Comments (1)

Answer - Posted 1 year ago by Mark
Avatar

Solved!
https://www.actiprosoftware.com/docs/controls/wpf/syntaxeditor/dotnet-languages-addon/assemblies

This code shows how to queue up parsing to create source files for a project assembly defined in project:

project.SourceFiles.QueueCode(cSharpSyntaxLanguage, "MyFile1.cs", "class Foo { public void Bar() {} }");
project.SourceFiles.QueueFile(cSharpSyntaxLanguage, @"C:\MyFile2.cs");
 
The latest build of this product (v24.1.0) was released 26 days ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.