Launching .Net 7 binaries seems is broken

I finally managed to make executable runnable.

That’s the solution.

base: core22

confinement: classic
compression: lzo

apps:
  ui:
    command: bin/app
    plugs:
      - desktop

parts:
  app:
    plugin: dotnet
    dotnet-build-configuration: Release
    source: ./sources
    build-packages:
      - dotnet-sdk-7.0
    override-build: |     
      dotnet publish /p:Version=$SNAPCRAFT_PROJECT_VERSION /p:AssemblyVersion=$SNAPCRAFT_PROJECT_VERSION -r linux-x64 -c Release --self-contained true -o $SNAPCRAFT_PART_INSTALL/bin/
      chmod 0755 $SNAPCRAFT_PART_INSTALL/bin/app

lint:
  ignore:
    - classic 
    - library

As a result you can run app via snap:name.ui .

Basically,

  1. dotnet plugin should build project with –self-contained true . Otherwise it will be impossible to launch executable.
  2. dotnet plugin should find executables and make them executables from csproj files which is easy. When those 2 steps will happen in future there will be no more need to override build.
  3. dotnet plugin should have documentation with hello world UI and console program, from which apps should be able to start with published on github, so i can download it as archive and use it, i.e. boilerplate.

This itself would save 2 days of work.

1 Like