How to build deb package without dotnet-runtime-3.1 dependency? #86

Open
opened 2026-01-29 16:28:56 +00:00 by claunia · 13 comments
Owner

Originally created by @vbenedichuk on GitHub (Sep 4, 2020).

I have to create a package which will be installed on the manually configured device.
It will already have a .net runtime downloaded and installed manually.
I've created a package, placed to the device but it requires dotnet-runtime-3.1 as a dependency.
How to disable this dependency?

Originally created by @vbenedichuk on GitHub (Sep 4, 2020). I have to create a package which will be installed on the manually configured device. It will already have a .net runtime downloaded and installed manually. I've created a package, placed to the device but it requires dotnet-runtime-3.1 as a dependency. How to disable this dependency?
Author
Owner

@ichan-akira commented on GitHub (Sep 10, 2020):

Yes I'm looking for this feature as well.

Fyi, for not so pretty workaround if you really need to install the *.deb package but ignoring the dependency problem, you can force it using:
sudo dpkg -i ./YourOutputPackage.1.0.0.deb

instead of:
sudo apt install ./YourOutputPackage.1.0.0.deb

which reject the installation because of dependency is not met.

@ichan-akira commented on GitHub (Sep 10, 2020): Yes I'm looking for this feature as well. Fyi, for not so pretty workaround if you really need to install the *.deb package but ignoring the dependency problem, you can force it using: `sudo dpkg -i ./YourOutputPackage.1.0.0.deb` instead of: `sudo apt install ./YourOutputPackage.1.0.0.deb` which reject the installation because of dependency is not met.
Author
Owner

@ichan-akira commented on GitHub (Sep 10, 2020):

After doing some test and with the clue from the README.md, and some reference from Force ‘dotnet publish’ to publish dependencies using PublishWithAspNetCoreTargetManifest and official Microsoft documentation.

you might be interested to use this command:

dotnet msbuild ./path/to/project/Your.Project.csproj /t:CreateDeb /p:TargetFramework=netcoreapp2.2 /p:RuntimeIdentifier=linux-arm /p:Configuration=Release /p:PublishWithAspNetCoreTargetManifest=false

I check the dependency:

user@machine:~$ dpkg -I ./Your.Project.deb 
 new Debian package, version 2.0.
 size 27187026 bytes: control archive=12477 bytes.
     496 bytes,     9 lines      control              
   44488 bytes,   405 lines      md5sums              
 Package: Your.Project
 Architecture: armhf
 Depends: libc6, libgcc1, libgssapi-krb5-2, libstdc++6, zlib1g, libssl1.1 | libssl1.0.2 | libssl1.0.1 | libssl1.0.0 | libssl0.9.8, libicu66 | libicu65 | libicu64 | libicu63 | libicu62 | libicu61 | libicu60 | libicu59 | libicu58 | libicu57 | libicu56 | libicu55 | libicu54 | libicu53 | libicu52
 Description: Package Description
 Installed-Size: 98051
 Maintainer: Your.Project
 Priority: extra
 Section: misc
 Version: 1.0.0

But I think you might want to change the /p:TargetFramework=netcoreapp2.2 into /p:TargetFramework=netcoreapp3.1 although I have not test that.

@ichan-akira commented on GitHub (Sep 10, 2020): After doing some test and with the clue from the [README.md](https://github.com/qmfrederik/dotnet-packaging#note), and some reference from [Force ‘dotnet publish’ to publish dependencies using PublishWithAspNetCoreTargetManifest](https://www.benday.com/2018/02/23/force-dotnet-publish-to-publish-dependencies-using-publishwithaspnetcoretargetmanifest/) and official [Microsoft documentation](https://docs.microsoft.com/en-us/dotnet/core/deploying/runtime-store#aspnet-core-implicit-store-net-core-20-only). you might be interested to use this command: ``` dotnet msbuild ./path/to/project/Your.Project.csproj /t:CreateDeb /p:TargetFramework=netcoreapp2.2 /p:RuntimeIdentifier=linux-arm /p:Configuration=Release /p:PublishWithAspNetCoreTargetManifest=false ``` I check the dependency: ``` user@machine:~$ dpkg -I ./Your.Project.deb new Debian package, version 2.0. size 27187026 bytes: control archive=12477 bytes. 496 bytes, 9 lines control 44488 bytes, 405 lines md5sums Package: Your.Project Architecture: armhf Depends: libc6, libgcc1, libgssapi-krb5-2, libstdc++6, zlib1g, libssl1.1 | libssl1.0.2 | libssl1.0.1 | libssl1.0.0 | libssl0.9.8, libicu66 | libicu65 | libicu64 | libicu63 | libicu62 | libicu61 | libicu60 | libicu59 | libicu58 | libicu57 | libicu56 | libicu55 | libicu54 | libicu53 | libicu52 Description: Package Description Installed-Size: 98051 Maintainer: Your.Project Priority: extra Section: misc Version: 1.0.0 ``` But I think you might want to change the `/p:TargetFramework=netcoreapp2.2` into `/p:TargetFramework=netcoreapp3.1` although I have not test that.
Author
Owner

@vbenedichuk commented on GitHub (Sep 10, 2020):

Thank you. I've solved this by using separate deb-pkg in my build pipeline.

@vbenedichuk commented on GitHub (Sep 10, 2020): Thank you. I've solved this by using separate deb-pkg in my build pipeline.
Author
Owner

@ichan-akira commented on GitHub (Sep 10, 2020):

Hi @vbenedichuk if you have extra time, would you mind to elaborate more of your solution?
I'm kinda interested with it.

@ichan-akira commented on GitHub (Sep 10, 2020): Hi @vbenedichuk if you have extra time, would you mind to elaborate more of your solution? I'm kinda interested with it.
Author
Owner

@qmfrederik commented on GitHub (Sep 10, 2020):

@ichan-akira

I have to create a package which will be installed on the manually configured device.
It will already have a .net runtime downloaded and installed manually.

Can you let me know how you installed the .NET runtime on the device?

You can override the default dependencies by setting the DebDotNetDependencies variable in your .csproj file, e.g.:

<ItemGroup>
      <DebDotNetDependencies Include="libc6"/>  
</ItemGroup>

The default dependencies are listed here:

https://github.com/qmfrederik/dotnet-packaging/blob/master/Packaging.Targets/build/Packaging.Targets.targets#L119-L162

@qmfrederik commented on GitHub (Sep 10, 2020): @ichan-akira > I have to create a package which will be installed on the manually configured device. > It will already have a .net runtime downloaded and installed manually. Can you let me know how you installed the .NET runtime on the device? You can override the default dependencies by setting the `DebDotNetDependencies` variable in your `.csproj` file, e.g.: ``` <ItemGroup> <DebDotNetDependencies Include="libc6"/> </ItemGroup> ``` The default dependencies are listed here: https://github.com/qmfrederik/dotnet-packaging/blob/master/Packaging.Targets/build/Packaging.Targets.targets#L119-L162
Author
Owner

@ichan-akira commented on GitHub (Sep 10, 2020):

You can override the default dependencies by setting the DebDotNetDependencies variable in your .csproj file, e.g.:

<ItemGroup>
      <DebDotNetDependencies Include="libc6"/>  
</ItemGroup>

This is the things that I never knew before! Thanks @qmfrederik this surely will help me out.

I'm currently using dotnet-packaging to create Debian installation package for Raspberry Pi and Ubuntu.
Your tool really help me alot!

@ichan-akira commented on GitHub (Sep 10, 2020): > You can override the default dependencies by setting the `DebDotNetDependencies` variable in your `.csproj` file, e.g.: > > ``` > <ItemGroup> > <DebDotNetDependencies Include="libc6"/> > </ItemGroup> > ``` This is the things that I never knew before! Thanks @qmfrederik this surely will help me out. I'm currently using dotnet-packaging to create Debian installation package for Raspberry Pi and Ubuntu. Your tool really help me alot!
Author
Owner

@qmfrederik commented on GitHub (Sep 10, 2020):

Thanks, @ichan-akira .

So the dependency on dotnet-runtime-3.1 is problematic for you because there is no package repository for .NET 3.1 for ARM/ARM64 (like Raspberry Pi), right?

How did you install the .NET runtime on your Raspberry Pi?

Do you think we should modify the defaults in dotnet-packaging for ARM32/64? If so, how?

@qmfrederik commented on GitHub (Sep 10, 2020): Thanks, @ichan-akira . So the dependency on `dotnet-runtime-3.1` is problematic for you because there is no package repository for .NET 3.1 for ARM/ARM64 (like Raspberry Pi), right? How did you install the .NET runtime on your Raspberry Pi? Do you think we should modify the defaults in dotnet-packaging for ARM32/64? If so, how?
Author
Owner

@ichan-akira commented on GitHub (Sep 10, 2020):

Btw, the original poster of this issue is @vbenedichuk, I'm just trying to help him since it happen my problem kinda similar to his. 😄

So the dependency on dotnet-runtime-3.1 is problematic for you because there is no package repository for .NET 3.1 for ARM/ARM64 (like Raspberry Pi), right?

Since I currently require ASP .NET Core 2.2, it is not a problem for me. Proper .NET Core package is provided by Microsoft at https://dotnet.microsoft.com/download/dotnet-core/2.2.

How did you install the .NET runtime on your Raspberry Pi?

I install it using *.tar.gz package provided by Microsoft. As for now--as far as I know--Microsoft does not provide ARM32 version of *.deb package for ASP .NET Core 2.2. Which means I cannot install it using apt-get install nor dpkg -i.

Do you think we should modify the defaults in dotnet-packaging for ARM32/64? If so, how?

I already have workaround for it by including the ASP .NET Core 2.2 in the *.deb installation package.
Unfortunately since I'm not on my work laptop I will elaborate more about how I do it tomorrow.

@ichan-akira commented on GitHub (Sep 10, 2020): Btw, the original poster of this issue is @vbenedichuk, I'm just trying to help him since it happen my problem kinda similar to his. 😄 > So the dependency on `dotnet-runtime-3.1` is problematic for you because there is no package repository for .NET 3.1 for ARM/ARM64 (like Raspberry Pi), right? Since I currently require ASP .NET Core 2.2, it is not a problem for me. Proper .NET Core package is provided by Microsoft at https://dotnet.microsoft.com/download/dotnet-core/2.2. > How did you install the .NET runtime on your Raspberry Pi? I install it using `*.tar.gz` package provided by Microsoft. As for now--as far as I know--Microsoft does not provide ARM32 version of `*.deb` package for ASP .NET Core 2.2. Which means I cannot install it using `apt-get install` nor `dpkg -i`. > Do you think we should modify the defaults in dotnet-packaging for ARM32/64? If so, how? I already have workaround for it by including the ASP .NET Core 2.2 in the `*.deb` installation package. Unfortunately since I'm not on my work laptop I will elaborate more about how I do it tomorrow.
Author
Owner

@ichan-akira commented on GitHub (Sep 11, 2020):

@qmfrederik before knowing following configuration could be made:

<ItemGroup>
      <DebDotNetDependencies Include="libc6"/>  
</ItemGroup>

I can successfully build *.deb package that I want using following command:

dotnet clean ./Project1/Project1.csproj --configuration Release --framework netcoreapp2.2 --runtime linux-arm --verbosity normal
dotnet publish ./Project1/Project1.csproj --configuration Release --framework netcoreapp2.2 --self-contained --runtime linux-arm --verbosity normal
dotnet msbuild ./Project1/Project1.csproj -target:CreateDeb -property:TargetFramework=netcoreapp2.2 -property:RuntimeIdentifier=linux-arm -property:Configuration=Release -property:PublishWithAspNetCoreTargetManifest=false

which the output will produce *.deb package not depend to aspnetcore package installed in the system.

Do you think we should modify the defaults in dotnet-packaging for ARM32/64? If so, how?

I am not really sure, but I think since Microsoft is not releasing ASP .NET Core 2.2 in form of Debian installer package for ARM32, user should be able to control (add/remove) the default dependency to output Debian installer package which the method is already provided from you at post https://github.com/qmfrederik/dotnet-packaging/issues/169#issuecomment-690311073.

As for now I will try to dig deep into your mentioned method to find is it suitable for my use case or not.

This project really need more in depth documentation as mentioned in https://github.com/qmfrederik/dotnet-packaging/issues/103. Since currently I am using Debian package I am planning to add more documentation especially for Debian package either in form of README.md or Wiki if you allow me 😃

@ichan-akira commented on GitHub (Sep 11, 2020): @qmfrederik before knowing following configuration could be made: > ``` > <ItemGroup> > <DebDotNetDependencies Include="libc6"/> > </ItemGroup> > ``` I can successfully build `*.deb` package that I want using following command: ``` dotnet clean ./Project1/Project1.csproj --configuration Release --framework netcoreapp2.2 --runtime linux-arm --verbosity normal dotnet publish ./Project1/Project1.csproj --configuration Release --framework netcoreapp2.2 --self-contained --runtime linux-arm --verbosity normal dotnet msbuild ./Project1/Project1.csproj -target:CreateDeb -property:TargetFramework=netcoreapp2.2 -property:RuntimeIdentifier=linux-arm -property:Configuration=Release -property:PublishWithAspNetCoreTargetManifest=false ``` which the output will **produce `*.deb` package not depend to aspnetcore package installed in the system**. > Do you think we should modify the defaults in dotnet-packaging for ARM32/64? If so, how? I am not really sure, but I think since Microsoft is not releasing ASP .NET Core 2.2 in form of Debian installer package for ARM32, user should be able to control (add/remove) the default dependency to output Debian installer package which the method is already provided from you at post https://github.com/qmfrederik/dotnet-packaging/issues/169#issuecomment-690311073. As for now I will try to dig deep into your mentioned method to find is it suitable for my use case or not. This project really need more in depth documentation as mentioned in https://github.com/qmfrederik/dotnet-packaging/issues/103. Since currently I am using Debian package I am planning to add more documentation especially for Debian package either in form of README.md or Wiki if you allow me 😃
Author
Owner

@vbenedichuk commented on GitHub (Sep 24, 2020):

Can you let me know how you installed the .NET runtime on the device?

https://edi.wang/post/2019/9/29/setup-net-core-30-runtime-and-sdk-on-raspberry-pi-4

You can override the default dependencies by setting the DebDotNetDependencies variable in your .csproj file, e.g.:

The issue is that I don't need any dependencies for the package. But looks like it is not feasible.

Anyway I've solved it.

@vbenedichuk commented on GitHub (Sep 24, 2020): > Can you let me know how you installed the .NET runtime on the device? https://edi.wang/post/2019/9/29/setup-net-core-30-runtime-and-sdk-on-raspberry-pi-4 > You can override the default dependencies by setting the `DebDotNetDependencies` variable in your `.csproj` file, e.g.: The issue is that I don't need any dependencies for the package. But looks like it is not feasible. Anyway I've solved it.
Author
Owner

@vbenedichuk commented on GitHub (Sep 24, 2020):

Hi @vbenedichuk if you have extra time, would you mind to elaborate more of your solution?
I'm kinda interested with it.

I've done it manually.
I've built a package using dotnet-packaging, extracted its contents using dpkg -x ...deb /tmp/myfolder.
Removed dependency and packed it back using dpkg-deb -b ...
After that, I've just updated pipeline to generate required folders/files structure, using initial package as a template, copy built code into it, and build it using dpkg-deb -b

@vbenedichuk commented on GitHub (Sep 24, 2020): > Hi @vbenedichuk if you have extra time, would you mind to elaborate more of your solution? > I'm kinda interested with it. I've done it manually. I've built a package using dotnet-packaging, extracted its contents using `dpkg -x ...deb /tmp/myfolder`. Removed dependency and packed it back using `dpkg-deb -b ...` After that, I've just updated pipeline to generate required folders/files structure, using initial package as a template, copy built code into it, and build it using `dpkg-deb -b`
Author
Owner

@ichan-akira commented on GitHub (Sep 24, 2020):

Ah I see, thanks for info @vbenedichuk definitely a workaround to solve it

@ichan-akira commented on GitHub (Sep 24, 2020): Ah I see, thanks for info @vbenedichuk definitely a workaround to solve it
Author
Owner

@atauenis commented on GitHub (Dec 12, 2020):

Such package can be built via two ways.

The first is to manually kill the dependency, but this is a dirty hack.

    <ItemGroup>
      <DebDotNetDependencies Remove="dotnet-runtime-3.1"/>
    </ItemGroup>

And the second is to make a self-contained app. Seems that dotnet-deb can detect this and replaces dotnet-runtime-3.1 with few prerequisites which need to run self-contained apps. It will work on any system, even where there are no .NET Core at all.

  <PropertyGroup>
    <SelfContained>True</SelfContained>
  </PropertyGroup
@atauenis commented on GitHub (Dec 12, 2020): Such package can be built via two ways. The first is to manually kill the dependency, but this is a dirty hack. ``` <ItemGroup> <DebDotNetDependencies Remove="dotnet-runtime-3.1"/> </ItemGroup> ``` And the second is to make a self-contained app. Seems that dotnet-deb can detect this and replaces `dotnet-runtime-3.1` with few prerequisites which need to run self-contained apps. It will work on any system, even where there are no .NET Core at all. ``` <PropertyGroup> <SelfContained>True</SelfContained> </PropertyGroup ```
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/dotnet-packaging#86