skip to Main Content

I want to know how to produce a c# executable file on Linux as when I build all I get is a DLL file in the bin folder that I don’t know how to execute.
Note: I’m using vscode as my code editor and Manjaro is my Linux distro.

2

Answers


  1. Did you try command?

    dotnet app_name.dll
    
    Login or Signup to reply.
  2. I guess a Publish Profile is What You are looking for.

    Add a file named MyPublishProfile.pubxml to your project with this content:

        <?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>binReleasenet6.0publish</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>
    

    save it and edit it (follow the provided links). then you can run

    dotnet publish -p:publishProfile=MyPublishProfile

    then you should have your excecutable. maybe you have to chmode it. you can read more here

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search