Repository: godot
Issue: Godot mono server/headless failed to run dedicated server
Labels: bug,platform:linuxbsd,topic:dotnet,topic:export

### Godot version

3.4.4-stable_mono_linux_headless/server
v3.5.stable.mono.official.991bb6ac7 server/headless

### System information

ubuntu 20.04

### Issue description
Godot mono server/headless can not read exported PCK/ZIP project. Doesn't even run if it is the game project itself.

Read the PCK/ZIP using SERVER version result in `ERROR: Cannot instance script because the project assembly is not loaded.`

Read the PCK/ZIP using HEADLESS version result in:
`ERROR: Failed to open ...` 
`ERROR: The assembly is invalidated and the prebuilt assemblies are missing.`
`and engine crash`

```
nongvantinh@Monday:/mnt/d/Projects/Godot/Godot_v3.5-stable_mono_linux_server_64$ ./Godot_v3.5-stable_mono_linux_server.64 --main-pack ../can_not_run_pck_zip/builds/server/can_not_read_pck_zip.zip
Godot Engine v3.5.stable.mono.official.991bb6ac7 - https://godotengine.org

Mono: Log file is: '/home/nongvantinh/.local/share/godot/app_userdata/can_not_run_pck_zip/mono/mono_logs/2022-08-19_00.55.41_4034.log'
ERROR: Cannot instance script because the project assembly is not loaded. Script: 'res://TheCSharpScript.cs'.
   at: can_instance (modules/mono/csharp_script.cpp:2889)
^C
nongvantinh@Monday:/mnt/d/Projects/Godot/Godot_v3.5-stable_mono_linux_server_64$
```


And using headless version, it failed to open some files and crash.

```
nongvantinh@Monday:/mnt/d/Projects/Godot/Godot_v3.5-stable_mono_linux_headless_64$ ./Godot_v3.5-stable_mono_linux_headless.64 --main-pack ../can_not_run_pck_zip/builds/server/can_not_read_pck_zip.zip
Godot Engine v3.5.stable.mono.official.991bb6ac7 - https://godotengine.org

Mono: Log file is: '/home/nongvantinh/.local/share/godot/mono/mono_logs/2022-08-19_00.55.25_3929.log'
ERROR: Failed to open res://.mono/assemblies/Debug/GodotSharp.xml
   at: copy (core/os/dir_access.cpp:297)
WARNING: Failed to copy 'GodotSharp.xml'.
     at: copy_prebuilt_api_assembly (modules/mono/mono_gd/gd_mono.cpp:676)
ERROR: Failed to open res://.mono/assemblies/Debug/GodotSharp.pdb
   at: copy (core/os/dir_access.cpp:297)
WARNING: Failed to copy 'GodotSharp.pdb'.
     at: copy_prebuilt_api_assembly (modules/mono/mono_gd/gd_mono.cpp:680)
ERROR: Failed to open res://.mono/assemblies/Debug/GodotSharp.dll
   at: copy (core/os/dir_access.cpp:297)
ERROR: Failed to copy 'GodotSharp.dll'.
   at: copy_prebuilt_api_assembly (modules/mono/mono_gd/gd_mono.cpp:684)
ERROR: The assembly is invalidated and the prebuilt assemblies are missing.
   at: _load_api_assemblies (modules/mono/mono_gd/gd_mono.cpp:940)

=================================================================
        Native Crash Reporting
=================================================================
Got a UNKNOWN while executing native code. This usually indicates
a fatal error in the mono runtime or one of the native libraries
used by your application.
=================================================================

=================================================================
        Native stacktrace:
=================================================================
        0xf47e6d - ./Godot_v3.5-stable_mono_linux_headless.64 :
        0xf481f9 - ./Godot_v3.5-stable_mono_linux_headless.64 :
        0xf3a8af - ./Godot_v3.5-stable_mono_linux_headless.64 :
        0xf51e50 - ./Godot_v3.5-stable_mono_linux_headless.64 :
        0x7fe885db23c0 - /lib/x86_64-linux-gnu/libpthread.so.0 :
        0x1398b56 - ./Godot_v3.5-stable_mono_linux_headless.64 : _ZN6GDMono20_load_api_assembliesEv
        0x1398c0d - ./Godot_v3.5-stable_mono_linux_headless.64 : _ZN6GDMono26initialize_load_assembliesEv
        0x16f5857 - ./Godot_v3.5-stable_mono_linux_headless.64 : _ZN14CSharpLanguage4initEv
        0x373fee2 - ./Godot_v3.5-stable_mono_linux_headless.64 : _ZN12ScriptServer14init_languagesEv
        0x11af968 - ./Godot_v3.5-stable_mono_linux_headless.64 : _ZN4Main6setup2Em
        0x11b4751 - ./Godot_v3.5-stable_mono_linux_headless.64 : _ZN4Main5setupEPKciPPcb
        0xe6b63d - ./Godot_v3.5-stable_mono_linux_headless.64 : main
        0x7fe885a720b3 - /lib/x86_64-linux-gnu/libc.so.6 : __libc_start_main
        0xe6ef8e - ./Godot_v3.5-stable_mono_linux_headless.64 :

=================================================================
        Telemetry Dumper:
=================================================================
Pkilling 0x140636585977600x from 0x140636651299840x
Could not exec mono-hang-watchdog, expected on path '/mnt/d/Projects/Godot/Godot_v3.5-stable_mono_linux_headless_64/GodotSharp/Mono/etc/../bin/mono-hang-watchdog' (errno 2)
WARNING: A Thread object has been destroyed without wait_to_finish() having been called on it. Please do so to ensure correct cleanup of the thread.
     at: ~Thread (core/os/thread.cpp:124)
Entering thread summarizer pause from 0x140636651299840x
Finished thread summarizer pause from 0x140636651299840x.
Failed to create breadcrumb file (null)/crash_hash_0x0

Waiting for dumping threads to resume

=================================================================
        External Debugger Dump:
=================================================================
mono_gdb_render_native_backtraces not supported on this platform, unable to find gdb or lldb

=================================================================
        Basic Fault Address Reporting
=================================================================
Memory around native instruction pointer (0x1398b56):0x1398b46  03 bf a9 3a d8 03 e8 2f 8d 29 02 e8 aa b9 26 02  ...:.../.)....&.
0x1398b56  0f 0b 0f 1f 84 00 00 00 00 00 45 31 c9 41 b8 b0  ..........E1.A..
0x1398b66  96 d8 03 b9 1c 5e ce 03 ba c9 03 00 00 e9 11 ff  .....^..........
0x1398b76  ff ff 0f 1f 84 00 00 00 00 00 45 31 c9 41 b8 70  ..........E1.A.p

=================================================================
        Managed Stacktrace:
=================================================================
=================================================================
Aborted
nongvantinh@Monday:/mnt/d/Projects/Godot/Godot_v3.5-stable_mono_linux_headless_64$

```

### Steps to reproduce

Export -> Add Presets -> Linux/X11 -> Export PCK/Zip

Method 1:
1. Zip the folder contain the file in to an archive.
2. Use `scp` to copy the archive file just created from local machine to the `server`: `scp can_not_read_pck_zip.zip user@host:~/Downloads`.
3. `ssh` to remote server, unzip the file, and [download Godot mono Server/Headless](https://godotengine.org/download/server).
4. Run the exported PCK/ZIP with command `godot3.5.exe --main-pack can_not_read_pck_zip.zip`.

Method 2:
1. [Setup WSL](https://docs.microsoft.com/en-us/windows/wsl/install) on Windows, [download Godot mono Server/Headless](https://godotengine.org/download/server)
2. Unzip the Godot mono Server/Headless somewhere near the PCK/ZIP file.
3. Shift -> right click `Open Linux shell here`.
4. Run the exported PCK/ZIP with command: `godot3.5.exe --main-pack ../builds/can_not_read_pck_zip.zip`

### Minimal reproduction project