add file system file reference (.cs) to SyntaxEditor

SyntaxEditor for Windows Forms Forum

The latest build of this product (v22.1.3) was released 4 months ago, which was before this thread was created.
Posted 2 months 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 2 months 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");
 

Add Comment

Please log in to a validated account to post comments.