Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DefineConstants csproj attribute is ignored by Extension's compiler #2121

Open
bruno-f-cruz opened this issue Feb 2, 2025 · 1 comment
Open
Labels
extensions.csproj Issue concerning local Bonsai extensions

Comments

@bruno-f-cruz
Copy link
Contributor

When trying to use protobuf c# code generator (https://protobuf.dev/reference/csharp/csharp-generated/) with older versions of .NET, one must toggle the GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE compiler flag (https://github.com/protocolbuffers/protobuf/tree/main/csharp). However, this flag seems to be ignored by the Extensions compiler. This is what I am trying:

  <PropertyGroup>
    <DefineConstants>GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE</DefineConstants>
  </PropertyGroup>
@PathogenDavid
Copy link
Member

Correct, Bonsai uses a very naive interpretation of Extensions.csproj which only supports:

  • ProjectReference items (Include and Version properties only)
  • UseWindowsForms (for visualizers)
  • AllowUnsafeBlocks (for Gonçalo and me)

(@banchan86 maybe this is something we should mention in the scripting extensions documentation?)

We could potentially add similar naive parsing of DefineConstants, but it's actually harder to fully support since it's more flexible than the others since it has SDK defaults. (On that note, <DefineConstants>$(DefineConstants);GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE</DefineConstants> is more correct.)

We've talked a few times about either reworking how Bonsai environments work entirely or reworking how scripting extensions work to make this less rigid, but it's not a simple problem to solve.

(As an aside this issue gave me a new idea for some proposals I'm working on that are semi-related so thanks for posting it!)

@PathogenDavid PathogenDavid added the extensions.csproj Issue concerning local Bonsai extensions label Feb 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
extensions.csproj Issue concerning local Bonsai extensions
Projects
None yet
Development

No branches or pull requests

2 participants