我想知道如何在 Linux 上生成 ac# 可執行檔案,因為當我構建時,我得到的只是 bin 檔案夾中的一個我不知道如何執行的 DLL 檔案。注意:我使用 vscode 作為我的代碼編輯器,Manjaro 是我的 Linux 發行版。
uj5u.com熱心網友回復:
你試過命令嗎?
dotnet app_name.dll
uj5u.com熱心網友回復:
我想發布組態檔是您正在尋找的。
使用以下內容將名為 MyPublishProfile.pubxml 的檔案添加到您的專案中:
<?xml version="1.0" encoding="utf-8"?>
<!--
https://go.microsoft.com/fwlink/?LinkID=208121.
-->
<Project>
<PropertyGroup>
<DeleteExistingFiles>false</DeleteExistingFiles>
<ExcludeApp_Data>false</ExcludeApp_Data>
<LaunchSiteAfterPublish>true</LaunchSiteAfterPublish>
<LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
<LastUsedPlatform>Any CPU</LastUsedPlatform>
<PublishProvider>FileSystem</PublishProvider>
<PublishUrl>bin\Release\net6.0\publish\</PublishUrl>
<WebPublishMethod>FileSystem</WebPublishMethod>
<_TargetId>Folder</_TargetId>
<SiteUrlToLaunchAfterPublish />
<TargetFramework>net6.0</TargetFramework>
<RuntimeIdentifier>linux-x64</RuntimeIdentifier>
<ProjectGuid>c21872b8-42b3-418a-ab47-103a60e7cd6c</ProjectGuid>
<SelfContained>true</SelfContained>
</PropertyGroup>
</Project>
保存并編輯它(按照提供的鏈接)。然后你可以運行
dotnet publish -p:publishProfile=MyPublishProfile
那么你應該有你的可執行檔案。也許你必須chmode它。你可以在這里閱讀更多
轉載請註明出處,本文鏈接:https://www.uj5u.com/ruanti/519919.html
標籤:C#linux视觉工作室代码.net-core可执行程序
