✅ Is .net required

i want to create a C# project. ive coded in C# before, but that was thru unity.. so this is the first time setting up the project. i am also not rly sure what .net is even used for like what it does, i dont need any UI or anyhging
88 Replies
arion
arion2y ago
Do you prefer a visual approach or a command line approach to building code? Visual studio can set up a lot of the stuff for you (including the sdks)
Itskillerluc
ItskillerlucOP2y ago
i dont mind cmd line i kinda want to use fleet cuz im testing that out at the same time
deathsangel1234
ASP.net is generally used for APIs. You don't need to use ASP.net at all, it's just a framework.
deathsangel1234
ASP.NET overview
Introduction to ASP.NET, a free framework for creating websites, web applications, and web APIs.
Thinker
Thinker2y ago
they didn't say ASP.NET .NET is the "framework" which C# runs on. Unless you're using Unity (which does its own weird stuff), the .NET SDK is what contains the compiler, build tools, etc., and you need it to do anything at all with C#.
Itskillerluc
ItskillerlucOP2y ago
i just said .net in genreal i thought windows ahd a native compiler
Thinker
Thinker2y ago
Yes but that one's really old and outdated
arion
arion2y ago
allright, first step would be to grab yourself a download of the SDK https://dotnet.microsoft.com/en-us/download/dotnet (.NET 6.0 or 7.0, your choice, higher the number the more recent it is.) When you click on one you can grab the Installer for the platform ur on and which architecture (x64 / x86) .NET Frameworks doesnt use a command line interface as far as i know
Microsoft
.NET Downloads (Linux, macOS, and Windows)
Official .NET downloads for Linux, macOS, and Windows. .NET is a free, cross-platform, open-source developer platform for building many different types of applications.
Itskillerluc
ItskillerlucOP2y ago
oh welli downloaded teh sdk
arion
arion2y ago
dotnet core does though ^^ dotnet
Itskillerluc
ItskillerlucOP2y ago
wdym they dont use cmd line interfaace
Thinker
Thinker2y ago
If you're gonna use Visual Studio, the installer will install everything for you.
Itskillerluc
ItskillerlucOP2y ago
then how do i use it nah i dont want visual studio also that doesnt work for me
Thinker
Thinker2y ago
Then you're gonna have to use the command line :/
Itskillerluc
ItskillerlucOP2y ago
tried to use it before but it complains about azure and stuff
arion
arion2y ago
can you run dotnet --info and see what comes up?
Itskillerluc
ItskillerlucOP2y ago
bwrong thing
Itskillerluc
ItskillerlucOP2y ago
It was not possible to find any installed .NET Core SDKs Did you mean to run .NET Core SDK commands? Install a .NET Core SDK from: https://aka.ms/dotnet-download
Microsoft
.NET Downloads (Linux, macOS, and Windows)
Official .NET downloads for Linux, macOS, and Windows. .NET is a free, cross-platform, open-source developer platform for building many different types of applications.
Itskillerluc
ItskillerlucOP2y ago
but i havent unzipped it yet or anything
Thinker
Thinker2y ago
run dotnet --list-sdks
Itskillerluc
ItskillerlucOP2y ago
nothing D:
Thinker
Thinker2y ago
Then you'll have to install the SDK
arion
arion2y ago
posted the link here where u can download them
Itskillerluc
ItskillerlucOP2y ago
do i just run dotnet.exe
Thinker
Thinker2y ago
well you just did that
Itskillerluc
ItskillerlucOP2y ago
fair then whats wrong where do i put the zip lol
Thinker
Thinker2y ago
I think you just unzip it and run the installer
Itskillerluc
ItskillerlucOP2y ago
i would but i dont see any installer inside of it
Thinker
Thinker2y ago
Did you download the right thing?
arion
arion2y ago
i think they downloaded "Binaries"
Thinker
Thinker2y ago
ah
Itskillerluc
ItskillerlucOP2y ago
did it no i dont think i did
Thinker
Thinker2y ago
Itskillerluc
ItskillerlucOP2y ago
oh i did smh
Thinker
Thinker2y ago
then run the exe that that downloads
Itskillerluc
ItskillerlucOP2y ago
i
Itskillerluc
ItskillerlucOP2y ago
but oh diff thing
Thinker
Thinker2y ago
yes
Itskillerluc
ItskillerlucOP2y ago
ok ye this looks better
arion
arion2y ago
NOOO
Itskillerluc
ItskillerlucOP2y ago
i only do this once right its the same as with the java sdk?
arion
arion2y ago
well, there's the sdk, and then there's the runtime
Itskillerluc
ItskillerlucOP2y ago
what java doesnt have that 0.o what do i do with th eruntime lol why do i need it
arion
arion2y ago
People need the runtime to "run" your program
Thinker
Thinker2y ago
basically The SDK installs everything, including the runtime yes it does
Itskillerluc
ItskillerlucOP2y ago
uh wtf
Thinker
Thinker2y ago
it's probably just installed along with the JDK
Itskillerluc
ItskillerlucOP2y ago
smh microsoft didnt expect anything less from them tbh
Thinker
Thinker2y ago
yeah you can disable that with an environment variable
Itskillerluc
ItskillerlucOP2y ago
oh nice
arion
arion2y ago
You have the SDK, which contains the runtime too, but your users need the runtime to run it, not the sdk
Itskillerluc
ItskillerlucOP2y ago
OH YE smh i forgot its the JRE of course wait users have to install stuff to run the application i create with this the whole reason i wanted to use C# was cuz its native so they dont have to do anything unlike with java
arion
arion2y ago
people have to install java too
Thinker
Thinker2y ago
well... yes... but that's an ancient version
Itskillerluc
ItskillerlucOP2y ago
thats why i wanted to use C# and not java
Thinker
Thinker2y ago
However, you can publish native executables
Itskillerluc
ItskillerlucOP2y ago
so it doesnt just build into .exe
arion
arion2y ago
this
Itskillerluc
ItskillerlucOP2y ago
that you can just use on any windows divice you want? what
Thinker
Thinker2y ago
well not by default, but you can enable that
Itskillerluc
ItskillerlucOP2y ago
wait what does it compile to by default
Thinker
Thinker2y ago
not really, again the only NET version that's included by default on Windows is absolutely ancient
Itskillerluc
ItskillerlucOP2y ago
is a diff language better for what i want or should i still use C# ugh but i cant have the user install things
Thinker
Thinker2y ago
C# is a great language totally not biased Again you don't have to, you can publish native executables so users don't have to install anything
Itskillerluc
ItskillerlucOP2y ago
0.o ok i thought this meant i couldnt
Thinker
Thinker2y ago
But it's a tradeoff - either you use a language like C++ or Rust and have to compile a separate version for each architecture, or you use a language like C# or Java which only require a runtime to be installed but is otherwise cross-platform There is no language which is 100% cross-platform and will work everywhere with no setup
Itskillerluc
ItskillerlucOP2y ago
C# is cross platform?! oh i only need it for windows i didnt know C# was crossplatform lol cool
Thinker
Thinker2y ago
again, you need the runtime, but yes it's cross-platform That ancient version of C# I mentioned is not xplat and Windows-only, and also really old
arion
arion2y ago
normal build:
arion
arion2y ago
self-contained (no runtime needed, but is x86):
Itskillerluc
ItskillerlucOP2y ago
oh
arion
arion2y ago
as u can see, a lot more files (and a lot more space it takes up dotnet build -f net7.0 dotnet publish -r win-x86 -f net7.0 --self-contained true But once you have access to the dotnet command, you can run dotnet new console to make a console project dotnet build to build it to an exe dotnet run to run it (basically)
Thinker
Thinker2y ago
yep all you have to do is
dotnet new console
dotnet run
dotnet new console
dotnet run
Itskillerluc
ItskillerlucOP2y ago
okay but what will the users have to do i want to have a all in one file what language should i use then like rust or C++ right?
Thinker
Thinker2y ago
again, you can still use C#
Itskillerluc
ItskillerlucOP2y ago
ok i dont undrstand anymore
Thinker
Thinker2y ago
Rust and C++ have to be published per architecture. C# and Java can either be published once as long as the user has the runtime installed or per architecture. Per architecture is a native executable which does not require a runtime.
Itskillerluc
ItskillerlucOP2y ago
oh ye i want that
arion
arion2y ago
this
Itskillerluc
ItskillerlucOP2y ago
oh ok i want it for x64
arion
arion2y ago
then do win-x64
Itskillerluc
ItskillerlucOP2y ago
ok fair idk what the diff is but well i know what the diff is on a low level... but idk what the diff actually is
Thinker
Thinker2y ago
On the low level, win-x64 gets compiled to native machine code, while regular compiles to an intermediate cross-platform format called IL. The cross-platform format requires the runtime to run. But it doesn't need to be recompiled per platform.
Itskillerluc
ItskillerlucOP2y ago
eh its only for windows so idc about the cross platform
Thinker
Thinker2y ago
If you were wanna publish something others can run, using an xplat language is really useful
Accord
Accord2y ago
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.
Want results from more Discord servers?
Add your server