mirror of
https://github.com/quamotion/dotnet-packaging.git
synced 2026-02-14 13:45:53 +00:00
Publish .NET Core 2.0 apps for RHEL #4
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @tmds on GitHub (Aug 24, 2017).
hi @qmfrederik this is a nice package. I'm want to check if it can be used for building .net core 2.0 apps that run on rhel and follow these guidelines: https://access.redhat.com/documentation/en-us/net_core/2.0/html/getting_started_guide/gs_install_dotnet#publish_applications.
My first attempt shows a .net core 1.0 framework is required to run the tool. Do you have plans to make it run on 2.0?
@qmfrederik commented on GitHub (Aug 24, 2017):
Hi @tmds
Yes, getting this to run on .NET Core 2.0 is definitively a goal. I don't think there's anything in the codebase that's not compatible with 2.0, but the CLI is very picky about how it loads tools.
I'll need to check whether we can get .NET Core 2.0 to load a .NET Core 1.0 executable, or whether we need to cross-build for both platforms.
I did some initial research;
318e1f8ba1and dotnet/cli#6705 may be releated but I need to double check; Xunit seems to have taken the cross-building approach: xunit/xunit@a88c7327e0@qmfrederik commented on GitHub (Sep 4, 2017):
@tmds I just merged #8 and pushed dotnet-rpm 0.1.1-r180 to NuGet.
That versions should work fine with .NET Core 1.0 and .NET Core 2.0; the demo.csproj file has been updated to target
netcoreapp2.0.Let me know if that works for you
@tmds commented on GitHub (Sep 5, 2017):
fails on restore for rhel.7-x64:
@qmfrederik commented on GitHub (Sep 5, 2017):
Yup, that's weird because it restores correctly if you don't specify
rhel.7-x64. Let me have a look.@qmfrederik commented on GitHub (Sep 5, 2017):
@tmds OK, this should work now. You need to specify the
RuntimeIdentifierin your.csprojfile, though. Here's what worked for me (with latest dotnet-rpm version).Let me know if it works for you.
@tmds commented on GitHub (Sep 26, 2017):
Sorry it took a while for me to respond. I'm giving this another try and making some suggestions.
Restore works when adding the
RuntimeIdentifier.Suggestion: it should work without having to set the RuntimeIdentifier.
Suggestion: the target framework and runtime may be picked up from the csproj to improve usablility.
I installed lzma-devel and lzma-libs. But the error persists.
A manual fix is needed
$ sudo ln -s /usr/lib64/liblzma.so.5 /usr/lib64/liblzma.so.Looking at the package info, it seems lzma is deprecated by xz.
Suggestion: maybe move to xz or not depend on native libraries (if possible)
No more error!
Suggestion: Like the cli does for the assembly, print out the path where the rpm was generated.
🎉
Perhaps I should have added some more metadata for it to show up here.
Let me know if I can help implement some of these suggestions.
@qmfrederik commented on GitHub (Sep 26, 2017):
Hi @tmds Thanks for the feedback!
I split off some of the issues you found in separate issues. They're all marked "up for grabs" :-).
Regarding the last error, one thing that catches my eye is that the package version number is missing from the package path (there should be a version number in between the two dots in
console..rhel.7-x64.rpm).The RPM version number is based off the
PackageVersionvariable which is set to eitherAssemblyFileVersionor1.0.0ifAssemblyFileVersionis empty. So it's weird you get an empty string anyhow.Can you add a
AssemblyFileVersionproperty in your.csprojfile and set it to a value like1.0.0and let me know what happens?@qmfrederik commented on GitHub (Sep 26, 2017):
Barring that, you should also be able to run:
to capture additional output from the build process.
@tmds commented on GitHub (Oct 9, 2017):
Without adding
AssemblyFileVersion,console.AssemblyInfo.cs(under obj/Debug/netcoreapp2.0/rhel.7-x64) has:dotnet msbuild /t:CreateRpm /p:RuntimeIdentifier=rhel.7-x64 /p:TargetFramework=netcoreapp2.0 /v:diaggives this output:
https://paste.fedoraproject.org/paste/fsKAupoYPbcHsDUDZsxJUQ
@qmfrederik commented on GitHub (Oct 10, 2017):
@tmds I had another look at this this evening.
I can confirm that you currently need to set the
AssemblyFileVersionfordotnet rpmto generate a valid RPM package. Once that's done, it works pretty well for me, though.Let's take the following
.csprojfile:Running
dotnet rpmgives this outputRPM seems to be (fairly) happy with the generated RPM package:
And installing works as well:
And yes, the demo project has been deployed to
/usr/local/demo:and it runs:
Just to be sure - does generating a package based on the
.csprojat the top of this comment work for you?PS: Ping me if you ever happen to be close to the Brussels area; I have the feeling we can straighten out most of the
dotnet rpmissues in a couple of hours ;-)@tmds commented on GitHub (Oct 11, 2017):
Some things are working better than before. The package seems not to be ok. It also fails to install due to
sigh load: BAD.I am doing this on Fedora 25.
It doesn't happen often I am near Brussels. I will investigate further (probably next week). Thank you for support and follow-up!
@qmfrederik commented on GitHub (Oct 11, 2017):
@tmds Thanks, I can reproduce this on Fedora 25. It's likely something's wrong with way I calculate the signature; it's odd since RHEL 7.3 and Centos 7.3 don't complain about the generated package.
In other news, I pushed r240 to NuGet which fixes a couple of the other items you've put forward:
AssemblyFileVersionproperty in the project; rather, we now useVersionwhich is populated automatically by the tools (if you don't set it it'll default to 1.0.0)liblzma.so.5, so no need to symlink.@qmfrederik commented on GitHub (Oct 11, 2017):
The RPM version seem to be different:
On RHEL7:
On Fedora 25:
Let me check what changed.
(note: command to configure RPM:
CPPFLAGS="-I/usr/include/nspr4 -I/usr/include/nss3" ./autogen.sh --with-external-db)@qmfrederik commented on GitHub (Oct 11, 2017):
The packages we generate work with RPM 4.13.0 but fail with RPM 4.13.0.1. Looking at the git history, there seem to be about ~20 commits between both releases, most focused on validating the GPG signatures, so it's likely the issue is with the GPG signature we generate.
I'll try to dive into that the coming days.
@qmfrederik commented on GitHub (Oct 12, 2017):
bb45f3364eis causing the validation to fail.@qmfrederik commented on GitHub (Oct 12, 2017):
@tmds OK - I think I managed to fix this one, it the ordering of the signature fields which was not to RPM's taste. It should work now on Fedora 25.
I'll do some tests with RPM from master - it looks like even stricter validation has been added in the dev versions of RPM.
@qmfrederik commented on GitHub (Oct 13, 2017):
RPM master added one more validation check (no empty arrays in metadata) which we violated; I fixed that and the RPM packages generated by dotnet rpm now work with the latest version of RPM. I've pushed that to NuGet as version 0.1.1-r260.
@ms0713 commented on GitHub (Nov 14, 2017):
@tmds Have you tried bulding .net core 2.0 app in Windows and running it on RHEL7? If yes then please share the steps here. I m able to build .net core 2.0 app using Visual Studio but not able to run it on RHEL.
When I build my .net core 2.0 app in 32bit runtime, it runs successfully in RHEL 7. But building 64bit .net core 2.0 app is not running in RHEL 7. My Visual Studio is 32 bit application so while running 32bit .net core 2.0 app it works fine as it runs on 32bit dotnet.exe. I have already installed 64bit dotnet.exe but my Visual Studio always launches 32bit dotnet.exe while running .net core appliaction.
Solution should be like that my Visual Studio must be able to identify between 32bit/64bit arch and launch dotnet.exe accordingly. How to acheive this that i dont know.
@tmds commented on GitHub (Nov 14, 2017):
@ms0713 Can you try publishing your .net core apps for RHEL following the guidelines here: https://access.redhat.com/documentation/en-us/net_core/2.0/html/getting_started_guide/gs_install_dotnet#publish_applications.
The goal of this issue is to see if 'dotnet rpm' can be used to package according to those guidelines.
@tmds commented on GitHub (Nov 14, 2017):
@qmfrederik I came across https://github.com/daveaglick/Buildalyzer/. I think it can it can help to figure out values from the project file for the packaging. Please take a look and let me know what you think.
@qmfrederik commented on GitHub (Nov 15, 2017):
@tmds Thanks, may be useful, I'll have a closer look at it.
That said, I was wondering now that corefx 2.0 is portable on Linux, whether we still need to worry about the RIDs. We're still building separately for
rhel-x64andubuntu-x64but I'm wondering whether we should just start targettinglinux-x64instead.What RID do you see most of RedHat/CentOS project targetting? Vanilla
linux-x64or something more targetted?@tmds commented on GitHub (Nov 17, 2017):
For dotnet publish, targetting rhel.7-x64 is the same as linux-x64.
In the docs, we suggest using the rhel.7-x64 as a way of customizing the csproj for that distro.
dotnet rpmcould do this similar:@qmfrederik commented on GitHub (Aug 31, 2018):
@tmds I've fixed a couple of other RPM-related bugs recently, plus added integration tests which create RPM packages and install them in Docker containers running Fedora, CentOS & friends.
I was thinking I could add CI test that packages a project that match your requirements and installs it in a Docker container based on RHEL, to make sure we don't regress on this scenario.
There doesn't seem to be a readily-available RHEL Docker image on Docker Hub, is that correct?
@tmds commented on GitHub (Aug 31, 2018):
If you have CentOS, then you covered RHEL too. There are no RHEL images on Docker Hub.
@tmds commented on GitHub (Jun 11, 2019):
I'm no longer looking into this, so I'll close the issue.