godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
91.59k stars 21.27k forks source link

c# solution ExportDebug generate files is deferent to default debug generate in editor #99923

Open isJDongYa opened 2 days ago

isJDongYa commented 2 days ago

Tested versions

v4.4.dev4.mono.official [36e6207bb]

System information

Godot v4.4.dev4.mono - Windows 10.0.22631 - Multi-window, 1 monitor - Vulkan (Forward+) - dedicated NVIDIA GeForce RTX 3080 Laptop GPU (NVIDIA; 31.0.15.5222) - AMD Ryzen 9 5900HX with Radeon Graphics (16 threads)

Issue description

I use .csproj file to import .targets from "Flecs.Net.Native" of "Flecs.Net" project.(https://github.com/BeanCheeseBurrito/Flecs.NET) Image

Click the run btn in editor will generate files likes: Image But "Export Debug" will generate files likes: Image

The dependency of project "flecs.dll" ,"libflecs.so" disappear. So When I export project for windows as well as android platform will emit "Dll not found" error。

Steps to reproduce

Look at desc

Minimal reproduction project (MRP)

exportcsharptest.zip

raulsntos commented 1 day ago

There are a number of differences between running in the editor and exporting your game.

Running in the editor builds your project using the dotnet build command, whereas an export will always use dotnet publish. There are a few differences between these 2 and you can read more about it in the Microsoft documentation.

We also always make export builds self-contained, so the exported game includes the .NET runtime and can be executed without having to install the .NET runtime.

Another difference is the build configuration, running in the editor will always use the Debug configuration, whereas exporting will use ExportDebug or ExportReleased depending on whether you are including debug information in the export.

In general, Debug and ExportDebug are very similar configurations and should behave the same with a few minor differences. For example, exported games don't have access to editor API, so the GodotSharpEditor assembly is not included when the build configuration is ExportDebug or ExportRelease.

As long as you are packaging your dependencies correctly, none of the things mentioned earlier should affect you. It could also be that the dependency you are using isn't packaging their native dependencies correctly, so the issue may not necessarily be in your project's .csproj.

Since this is an packaging issue, your MRP needs to include the revelant MSBuild files to reproduce it. Unfortunately, your .csproj has the <Import> property commented and the Flecs.NET.Native.targets file is nowhere to be found.

Please upload an MRP that can actually reproduce the issue.

isJDongYa commented 6 hours ago

Tested versions

v4.4.dev4.mono.official [36e6207bb]

System information

Godot v4.4.dev4.mono - Windows 10.0.22631 - Multi-window, 1 monitor - Vulkan (Forward+) - dedicated NVIDIA GeForce RTX 3080 Laptop GPU (NVIDIA; 31.0.15.5222) - AMD Ryzen 9 5900HX with Radeon Graphics (16 threads)

Issue description

Sorry, I must rephrase my question here because I writed over is not clear.

My real purpose is using "flecs"(c language) through "Flecs.Net" in c#, and i have used it successfully on Windows OS. When I complie to Android (arm64-v8a), the "Flecs.Net" can't find the "flecs" dynamic library.

I use normal nuget package reference this time. It‘s behavior is the same as last time I reference to the souce code project. Image

And I confirm that the "libfecs.so" dynamic lib is in the correct archi dir "/lib/arm64-v8a" in the .apk package. Image

I have checked my android phone "Huawei P50 pro" is "arm64-v8a" Image

It behaves correctly when I export to Windows x64

The MRP is attacked hereExportCsharpTest.zip