ForNeVeR / PascalABC.NET.SDK

MSBuild SDK for PascalABC.NET

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

NuGet support

ForNeVeR opened this issue · comments

The whole point of this SDK is to allow adding NuGet packages to PascalABC.NET projects.

Ideally, I want everything to be generated automatically: I just add <PackageReference>s to my .pasproj, as usual, and the referenced libraries then automatically get available in the .pas files.

But there are several obstacles among that way; here I'm basing my assumptions on an earlier related investigation.

  1. To add the libraries, we have to add {$reference <relative-dll-path>} to the main module of the application.
    • it's impossible to pass referenced assemblies to the compiler via the command line, fine
    • is it possible to add these to a non-main module, just generate an empty module full of references and then reference from the main module?
    • is it possible to use absolute paths and thus avoid copying of the references?
  2. Since .NET Framework is our main target runtime for now as it seems, we have to generate the App.config for our application. The C# SDK is able to do that automatically; could we reuse the same logic, or should we write our own?
  3. For the compiler to load the referenced assemblies, its own App.config has to be patched as well (the reasons are mentioned in my post linked above). We surely may automate that, but we should choose a strategy. Just copy the whole compiler to obj and then patch in place? Seems fine for now.
  4. We also need to copy the referenced assemblies on build (only for .exe projects actually, but for now we only support such projects anyway).
  5. After we're done with that, please don't forget to share the feedback with compiler authors. It could be useful for them to do some related improvements.