❔ Anyone here know Makefiles?
Hi. I need to install Newtonsoft JSON with a Makefile for a University Project. And once I do that, how do I make sure my code will be able to access it?
22 Replies
Current Makefile:
do you have to use make and mono?
.NET has a project system
(also, why on earth is your Makefile calling apt?)
@JaxOnThat
in modern .NET you could use the built in System.Text.Json
and if you still needed NewtonSoft, would just be
dotnet add package Newtonsoft.Json
in the same dir as the csproj
then builds would pull it from nuget automaticallyInstall .NET on Linux distributions - .NET
Learn about how to install .NET on Linux. .NET is not only available at package.microsoft.com, but also the official package archives for various Linux distributions.
if you must use mono, then you should still be able to use nuget
but please use the project system, don't use make of all things
It's for a University Project, if I could avoid Make I absolutely would 😅 🔫
as for why I need Mono, it's getting run on Linux
if you use modern .NET it will run on linux
i'm guessing that's not what i'm doing?
i dont know
Mono is not .NET
It's a sort of a demented port of the old .NET Framework
ah
.NET works on Linux out of the box
how do i change it to use .net
No makefiles or anything else required
Just get the .NET 7 SDK and you're set
I cannot abandon the Makefile, it is part of the assignment parameters 😦
and also i cannot install things on the machine they will run this on
outside of the makefile
.NET can depoloy single-file executables
They bundle the runtime and everything else
And trim the unused parts
So you end up with just a single runnable file
is there a way i can activate it from a Makefile?
Idk maybe?
Just have the makefile execute the $singlefile command lol
dotnet publish -c Release -r <runtime identifier> -p:PublishSingleFile=true
Use of -p:PublishSingleFile=true
implies --self-contained true
. Add --self-contained false
to publish as runtime-dependent.
-r RID
and -p:PublishSingleFile=true
can be moved to .csproj as the following properties:but to target multiple RIDs, you have to use dotnet publish
with the -r
option for each RID.
You can also add -p:IncludeNativeLibrariesForSelfExtract=true
to include native libraries (like Common Language Runtime dlls) in the output executable.
You might want to instead publish your application compiled Ahead Of Time to native code, see $nativeaot for examples.
https://docs.microsoft.com/en-us/dotnet/core/deploying/single-file
https://docs.microsoft.com/en-us/dotnet/core/rid-catalog
https://docs.microsoft.com/en-us/dotnet/core/tools/dotnet-publishCreate a single file for application deployment - .NET
Learn what single file application is and why you should consider using this application deployment model.
.NET Runtime Identifier (RID) catalog - .NET
Learn about the runtime identifier (RID) and how RIDs are used in .NET.
And have it install the SDK I guess
alright, i think i know how to make this work
(hopefully)
I'll come back here if I can't figure it out
thanks for the help, everyone
Why on earth would they teach such useless trash 😭
Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.