How should a dotnet core command line application be installed on a Linux system - linux

I'm maintaining a couple of .NET applications on GitHub. I've been getting requests to port them over to .NET Core so that they can be used on Linux systems. I would like to make the Linux users' life easy by providing some sort of package like NuGet that can be installed.
However I'm not aware of any conventions for where the executable files actually should live in the file system. Ideally, the binaries will be deployed in directories on the PATH, but I'm not sure what convetions dotnet Core uses when it comes to the physical locations of .NET assemblies.
Ideally, I'd like to deploy:
The main assembly, pytocs.dll
A shell script that asks the dotnet core executive to launch the tool:
#!/bin/bash
dotnet pytocs.dll "$#"
but I don't know where those two file should go.

Related

How to install Node JS in Docker with a Windows Container dotnet/aspnet:6.0?

Seems like something that should be fairly simple, but since windows containers are using nano and don't have msiexec.exe to install packages with I'm not finding a well established alternative after googling for several hours now. So, how would one best do the below in a nano based windows container?
RUN msiexec.exe /i https://nodejs.org/dist/v18.7.0/node-v18.7.0-x64.msi /quiet
What I'm using:
Windows Docker Containers
dockerfile VS makes, which has a base of dotnet/aspnet:6.0 and uses dotnet/sdk:6.0 in the build stage
Base stage of dockerfile where I want to do my install of node at:
FROM mcr.microsoft.com/dotnet/aspnet:6.0 AS base
WORKDIR /app
EXPOSE 80
EXPOSE 443
# install node for npm usage
RUN msiexec.exe /i https://nodejs.org/dist/v18.7.0/node-v18.7.0-x64.msi /quiet
For what it's worth, I'm use to Linux based containers and this is the first time I've tried out using Windows ones. Please correct me on anything I may have misspoken on or misrepresented.
Welcome to the Windows world! :)
On Windows, .Net has two flavors: .Net and .Net Framework. The former (.Net) was previously called .Net Core and since its renaming to .Net it has caused some confusion.
To clarify:
.Net Framework is the legacy framework on which .Net was only available in Windows.
.Net (formerly called .Net Core) is available on Windows and Linux. At first, .Net on Windows was only available on Nano Server base container images. However, recently the team made it available on the Server Core image, which supports a wider range of pre-requisites, such as MSIEXEC.
My suggestion to you is to look at the list of available tags for the image you want to use here: https://mcr.microsoft.com/en-us/product/dotnet/aspnet/tags
Also, look at the documentation of Windows containers. There's a particularity of Windows containers which is a version match requirement between container host and container. More details here: https://learn.microsoft.com/en-us/virtualization/windowscontainers/deploy-containers/version-compatibility?tabs=windows-server-2022%2Cwindows-11-21H2

How to install dependent binaries on Azure App Service with Linux?

I have a spring boot application that I am running on Azure App Service (Linux). My application has a dependency on a binary and needs it to be present on the system. How do I install it on my App service?
I tried the following two options:
Did ssh via Kudu and installed the package ($ apk add package). But the changes are not persisted beyond /home. The dependencies were installed in other folders and when the app service was re-deployed all those dependencies were gone
Used the post deployment hook to run the command "$ apk add package" to install once the deployment finishes. This script is run as can be seen from the custom log statements but still i do not see the installed package. Even when is use apt-get it says "unable to lock administration directory"
Using a statically compiled binary is not an option for me since that has its own issues.
Thanks
For the Tomcat, Java SE and WildFly apps on App Service Linux, you can create a file at /home/startup.sh and use it to initialize the container in any way you want (Example: you can install the required packages using this script).
App Service Linux checks for the presence of /home/startup.sh at the time of startup. If it exists, it is executed. This provides web app developers with an extension point which can be used to perform necessary customization during startup, like installing necessary packages during container startup.
I think this is a common problem with Linux on Azure.
I recommend having a step back and consider one of the following options.
Run your application in a container that has all the dependencies
you are looking for.
Run your application on Linux VM IaaS instead
of Azure App Service (Linux),PaaS.
Run your application on Windows OS PaaS and add extension for your dependency.(Most likely you won't run into this problem when using Windows OS)
While I understand that none of them might be acceptable by you, but I have not found a solution for that problem in those specific circumstances.

How create build .net with MSBuild in Jenkins on Server Linux

I tried to configure jenkins that is mounted on a server with linux, is it possible to install msbuild.exe to compile a .NET application? or is it necessary for Jenkins to be on a windows server?
The .NET Core SDK can be installed on Linux and comes with a tool called dotnet which can work pretty similar to MSBuild when you run it as dotnet build.
It depends on what purpose. If it is to study, I recommend installing Jenkins on a Windows Server, then installing the .Net Framework SDK that you want to use.
If it is a productive environment, I recommend installing Jenkins Master on Linux Server and a Slave on Windows Server, then installing the .Net Framework SDK that you want to use. So you do not overload the Jenkins as you compile.
If you look at the version of the .Net Framework SDK, because if any font needs something specific, you will have to install the Microsoft Windows SDK.
For configuration see this link.

DNU publish to linux runtime from windows OS

I want to publish using dnu to run on linux from a windows machine. This is required to make docker images, I know the usual practice is to push the source to linux docker and do "dnu restore", but that sounds a lengthy process, and completely against the cross-compat that the DNXCore50 is trying to offer.
The latest dnx runtime now includes a "runtime" for unix/darwin related packages to target the other operating systems. But how to run a publish command that targets linux or rather if there is a way to pull the linux dnx core in a windows machine using dnvm install coreclr??

How to make self-contained or java-bundled JavaFX application package for ARM

Where could I acquire a working copy of compiled JavaFX app bundled with JRE so I could execute this app on ARM linux?
or
How can I create my JavaFX app + JRE bundle that would work on ARM Linux
Best case scenario for me would be to be ableto create copy-paste enabled folder tree or single executable file..
I do understand that this question might be too vague, but I desperately need some help on this. I have spent more than 6 evenings + 2 nights searching how to get a compiled JavaFX application ( .jar file) to run on ARM linux on UDOO (RPi2-like) board.
I have been more of an .NET guy a long time, and now I had to make WPF-like rich UX app that would run on this specific hardware, and I chose JavaFX due to its likeliness to WPF. It does run fine on my desktop PCs but I absolutely can not get it to run on ARM linux.
I am trying to do this too. Did you get it working? My solution is to package the JAR using tools provided by IntelliJ or any other IDE, include the JRE in a folder within the app, then write a script that invokes the JAR from the included JRE like:
lib/jre/bin/java -jar runthis.jar
I also tried it for two days now but didn't get it to work.
I use maven in combination with the javafx-maven-plugin to build native installers of an application.
At first I got the error, that the javafx-ant.jar tools are missing:
[ERROR] Failed to execute goal build-jar(create-jfxjar) on project foo:
Execution create-jfxjar of goal build-jar failed: Plugin javafx-maven-plugin or
one of its dependencies could not be resolved: Could not find artifact
javafx-packager:javafx-packager:jar:1.8.0 at specified path
/opt/jdk1.8.0/jre/../lib/ant-javafx.jar
Then I found the ant-javafx.jar in a windows JDK but then another error was reported that linux is not supported with this one. Ok so I downloaded a linux JDK and used that ant-javafx.jar. Now it could build and create a *.deb file successfully!
However when I started the installer it failed with a message and when checking the log (/var/log/apt/term.log)
Log started: 2021-04-29 00:40:01
dpkg: Error creating archive
/home/pi/Foo/target/jfx/native/foo.deb (--unpack):
package architecture (amd64) does not match system (armhf)
Then I did research and found the following mailing list entry:
[...] the Java Packager isn’t shipped with any ARM builds that I’m aware of. Currently it is only for X86 Windows, Linux and Mac. [...]
This basically explains it: The packager doesn't work on ARM for now. Maybe we should write the guy to encurage him to add it...
=> So for now I work with the jar directly.

Resources