好奇,怎么同时编译三个系统的执行文件? go 就可以,C#在发布里面没找到,搜索引擎资料也很少,跟着编译也不行。
开发:vs2022 、Rider
![]() | 1 fgwmlhdkkkw 2024-08-14 18:40:55 +08:00 via Android |
2 supemaomao 2024-08-14 18:41:25 +08:00 via Android 如果直接用 vs 编译的话我没试过,但是我用 vs 开发,编译为 docker 镜像,是可以交叉编译为 amd 和 arm 的。理论上在 vs 中也是可以的。 |
![]() | 3 sagaxu 2024-08-14 18:44:32 +08:00 dotnet publish -c release -r win-x64 dotnet publish -c release -r linux-x64 dotnet publish -c release -r osx-x64 |
![]() | 4 Al0rid4l 2024-08-14 22:23:51 +08:00 @fgwmlhdkkkw 这是 AOT, 但是 LZ 问的也不是 AOT 啊... |
![]() | 5 liuliuliuliu PRO |
![]() | 6 liuliuliuliu PRO 如果说是“同时” 那么你需要在 csproj 中写明平台,例如 <RuntimeIdentifiers>win-x64;osx-x64;linux-x64</RuntimeIdentifiers> 然后只需要 dotnet publish 就可以了 参见 https://learn.microsoft.com/en-us/dotnet/core/project-sdk/msbuild-props#runtimeidentifier |
![]() | 7 lisxour 2024-08-15 09:03:47 +08:00 native 不太清楚,但是你完全可以用.net core |
![]() | 8 LLaMA2 2024-08-15 09:16:41 +08:00 接#5 #6 微软家很多东西有中文文档,也可以拿来参照 https://learn.microsoft.com/zh-cn/dotnet/core/deploying/ https://learn.microsoft.com/zh-cn/dotnet/core/project-sdk/msbuild-props#runtimeidentifier en-us 改 zh-cn |
![]() | 9 yuaotian OP 好的,感谢大家~~~ |
10 CodeCodeStudy 2024-09-26 09:35:53 +08:00 简单来说,AOT 是不能交叉编译的,非 AOT 的话如果把 runtime 打包进去也是不能交叉编译的 |