Aspects: Is there a way to get the solution file? (No, there isn't)

The service parameter has the property ProjectFileName.
Is there also a possibility the get the SolutionFileName (including the path)?
If not, can that be added?

Aspects: Is there a way to get the solution file?

I’m afraid not.No. the actual compiler has no concept of a solution (or even, as far as should be relied on, the project file) at that level. What’s the end goal here?

Marc, The compiler is ebuild.exe?
That one has a parameter that defines the solution, so it should know what the solution file is (it is also used at the pre-build event of a project($(SolutionPath)).

The end goal is to walk the complete solution (as I explained in Slack).

But that said - I can use the pre-build event to write this data to a specific location …
That would solve it …

I’m talking the “compiler” as the set of code that does the core compilation (which includes aspects). EBuild is a very high-level wrapper around the many tasks that happen for a build, with the compile just being one task. think of the compiler as a class that gets called by ebuild, and that — basically — just gets passed a list of objects (files, references) and settings (some of which are objects/settings set in the project file, and others generated/modified by the other tasks that ebuild runs prior and after).

Sometimes it does, sometimes it doesnt (you can build a solution-less .elements project, form example).

I could certainly make EBuild define that variable, if available, to be usable in rebuild tasks, yes. will do. but that said:

i’d still prefer to understand what the goal is you’re trying to accomplish, not just what you (think :wink: you need to accomplish it, as there might be a better/cleaner way. What information do you plan to glean from the solution file (also, how do you expect to read it — write your own parser for the, admittedly simple, but not that simple, file format? that seems like reinventing the wheel and duplicating effort).

If I can understand what the end goal is, I can see what would be the clean way to let EBuild do what’s needed/gather the info needed by the aspect.

pre-build are a per-user-project hack though; I’m assuming this is something we’d want in the actual tool chain,. not encoded isn each user’s project…

Ok, let’s try to be simple.

I have 2 projects.
Project 1 is an exe, project 2 is a dll - referenced by project 1
In project 1 I add the lines:

[myAspect]
Sub x(a As String)
End Sub

This aspect must create code in project 1 AND project 2

Project 2 is the Multi Target Dll for the Unified GUI.
This is compiled for use in project 1 but also for the Web Assembly

What the end result should be:

Generated Code in Project 1

Public Sub Register_x() Handles Me.RegisterDelegates
  Project2.Lpc_class.LPC_x_delegate = AddressOf(x)
End Sub

Generated Code in Project 2 - when not compiled against WASM

Public Const LPC_x = "x"
Public Delegate x_Delegate Sub(a as String)
Public Property LPC_x_Delegate as x_Delegate
Public Sub x(func As String, args As RemObjects.Elements.RTL.Dictionary(Of String, String), ByRef result As String) Handles Me.Dispatch
  If func = LPC_x Then
    LPC_x_Delegate.Invoke(args("a").ToString)
  End If      
End Sub

Generated Code in Project 2 - when compiled against WASM

Public Const LPC_x = "x"
Public Sub x(a As String)
  Dim args As new RemObjects.Elements.RTL.Dictionary(Of String, String)
  args.add("a", a)
  LPC_Call.invoke(LPC_x, args)     
End Sub

This exposes the LPC implementation as a call to the WASM and implements the dispatcher form the http server for this call.

Problem with this

  1. When the aspect in project 1 is running, project 2 is already compiled
  2. When an aspect in project 2 is running, the code in project 1 is unkown

Solution for this
In project 2 I need another aspect to generate some code.
I use this aspect also to generate the code for project 2 as defined above.
But: The Aspect processing can only access the current project, so the code in project 1 is unknown at this moment - but needed to generate the correct code.
So, to get the codelines needed in Project 1 to generate the code in Project 2, I have no other possibility than just walk the solution, projects and code files to find them and use them in Project 2.

Then a step further.

Project 1 is a user project, so this can be in any of the 6 languages.
In project 2 I need a fixed format to be able to create the code - that’s why I asked if it was possible with CG4 (any language in -> fixed format)

I managed to solve one part of the problem.

In project 2 I added the code (not generated):

Public Delegate Sub LPCDelegate(args As RemObjects.Elements.RTL.Dictionary(Of String, String), ByRef result As String)    
Private LPCDelegates As New Dictionary(Of String, LPCDelegate)
Public Sub AddLPCDelegate(func As String, theDelegate As LPCDelegate)
  LPCDelegates.Add(func, theDelegate)
End Sub
Public Sub LPCDispatch(func As String, args As RemObjects.Elements.RTL.Dictionary(Of String, String), ByRef result As String) Handles Me.Dispatch
  For each key As String in LPCDelegates.Keys
    If func = key then
      LPCDelegates(key).Invoke(args, result)
    End If
End Sub

Now, in project 1 I can generate the code:

Public Delegate Sub x_LPCDelegate(args As RemObjects.Elements.RTL.Dictionary(Of String, String), ByRef result As String)    
    x(args("a").ToString)
End Sub
Public Sub Register_x() Handles Me.RegisterDelegates
  Project2.Lpc_class.AddLPCDelegate("x", AddressOf(x_LPCDelegate))
End Sub

Now I only have to find the solution for the “project 2- compiled against WASM” part.

Conclusion: The answer is NO.