Skip to content

Issue with cs-script Compilation in Unity Standalone Build (.NET Framework 4.8) #422

@pavelkux

Description

@pavelkux

Hello,
I realize my situation might be an edge case, as not many people are using the .NET Framework branch—let alone within Unity. If you decide this isn’t worth pursuing, I would completely understand.

That said, I was hoping you might be able to shed some light on the issue I'm facing:

  • I’m developing a game in Unity.
  • It includes a business layer written in .NET Framework 4.8.
  • The game uses a library with cs-script for running player-created scripts.
  • Everything works perfectly in the Unity Editor, and it also worked previously outside Unity.
  • However, the issue arises when I build a standalone version of the game from Unity.
  • It crashes when it attempts to compile scripts on the fly.

The exception is:

Error running D:\GamePath\Tests\mono\mini\mono.exe: System cannot find the file specified.
Interestingly, there’s no mini folder (and never was). The actual build is located at D:\GamePath\Tests\Game\Build
It seems the issue stems from Unity Editor using its own Mono runtime to compile the scripts successfully, but in the standalone build, the stripped-down version of Mono provided by Unity cannot compile code dynamically.

One potential fix I considered is distributing Mono alongside the game (or requiring it as a prerequisite) and manually setting the path to mono.exe. Unfortunately, I haven’t been able to find a way to configure this path in cs-script.

Do you have any suggestions for resolving this? Or perhaps an alternative approach I could try?

Thank you in advance!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions