✅ 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
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)
i dont mind cmd line
i kinda want to use fleet
cuz im testing that out at the same time
ASP.net is generally used for APIs. You don't need to use ASP.net at all, it's just a framework.
ASP.NET overview
Introduction to ASP.NET, a free framework for creating websites, web applications, and web APIs.
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#.
i just said .net
in genreal
i thought windows ahd a native compiler
Yes but that one's really old and outdated
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.
oh
welli downloaded teh sdk
dotnet core does though ^^
dotnet
wdym they dont use cmd line interfaace
If you're gonna use Visual Studio, the installer will install everything for you.
then how do i use it
nah i dont want visual studio
also that doesnt work for me
Then you're gonna have to use the command line :/
tried to use it before but it complains about azure and stuff
can you run
dotnet --info
and see what comes up?bwrong thing
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.
but
i havent unzipped it yet or anything
run
dotnet --list-sdks
nothing D:
Then you'll have to install the SDK
posted the link here where u can download them
do i just run dotnet.exe
well you just did that
fair
then whats wrong
where do i put the zip lol
I think you just unzip it and run the installer
i would but i dont see any installer inside of it
Did you download the right thing?
i think they downloaded "Binaries"
ah
did it
no
i dont think i did
oh i did
smh
then run the exe that that downloads
i
but
oh
diff thing
yes
ok ye this looks better
i only do this once right
its the same as with the java sdk?
well, there's the sdk, and then there's the runtime
what
java doesnt have that 0.o
what do i do with th eruntime lol
why do i need it
People need the runtime to "run" your program
basically
The SDK installs everything, including the runtime
yes it does
uh wtf
it's probably just installed along with the JDK
smh microsoft
didnt expect anything less from them tbh
yeah you can disable that with an environment variable
oh
nice
You have the SDK, which contains the runtime too, but your users need the runtime to run it, not the sdk
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
people have to install java too
well... yes... but that's an ancient version
thats why i wanted to use C#
and not java
However, you can publish native executables
so it doesnt just build into .exe
that you can just use on any windows divice you want?
what
well not by default, but you can enable that
wait what does it compile to by default
not really, again the only NET version that's included by default on Windows is absolutely ancient
is a diff language better for what i want or should i still use C#
ugh
but i cant have the user install things
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
0.o
ok i thought this meant i couldnt
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
C# is cross platform?!
oh i only need it for windows
i didnt know C# was crossplatform lol
cool
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
normal build:
self-contained (no runtime needed, but is x86):
oh
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)yep
all you have to do is
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?
again, you can still use C#
ok i dont undrstand anymore
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.
oh
ye i want that
oh
ok
i want it for x64
then do win-x64
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
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.
eh
its only for windows
so idc about the cross platform
If you were wanna publish something others can run, using an xplat language is really useful
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.