Check out my courses:
Become a Patreon and get source code access:
Hello everybody I’m Nick and in this video I will show you how you can use .NET 7’s new NativeAOT capabilities to compile your C# code into NATIVE code that runs just like Rust, Go, C or C++!
Workshops
NDC Sydney | 10 – 14 Oct |
dotnetdays | 20 – 22 Oct |
NDC Minnesota | 15 – 18 Nov |
NDC London | 23-27 January 2023 |
Don’t forget to comment, like and subscribe 🙂
Social Media:
Follow me on GitHub:
Follow me on Twitter:
Connect on LinkedIn:
Keep coding merch:
#csharp #dotnet
it's not a real native code. many of us want to compile c# into the native code, so others can not decompile the exe back to source code. but with this NativeAOT, one can easily decompile the exe/dll into source code again.
Is there any other tools to compile c# framework project into native code, so it can not decompile to source merely with exe/dll ? I am eager to find such tools
Love your explanation. Thank you
Can we convert windows forms into intermediate language? I'm guessing not lmk
I used "csc Program.cs" and the output was a single file and it wasn't stupidly huge.
Coooooool, hope this come to webapis
Aot compiling dont supported for ASP .Net Core projects? Only for console?
Imagine if you could AOT compile your c# program with clang -O3 and avx2 this would be nuts
the single file option is only slow on the first run when it unpacks the file. after that it's fast.
Finally!!! Since I've started the C# course I'm currently part of, and ever since becoming interested in C#, I've always hoped to find a way to build to every architecture natively in order to avoid relying on the end user having the .NET runtime, or having to ship gigantic amounts of supporting files!
The amount of performance optimization that can be done here is most likely a good chunk, and I can't wait to see what this AoT option evolves to!
Electron apps face the same issue, without having a framework preinstalled on the local machine each application must contain everything to run which makes each project unnecessarily large.
I'm hoping at some point web browsers adopt the ability to install DLL's which can be used by any site so that we can get away from having to use JS to interact with the DOM. Assuming Blazor takes hold maybe we can work towards Wasm's being cacheable for all domains.
This is the best C# news ever !!!
Question: Is this new to C#/.NET?
I have waiting this moment for years. I waiting it from when it was called CoreRT.
Thanks a lot for this video! Does it work if code contains reflection? Are there any other restrictions?
Does AOT apps have GC and if not how are strings cleanup?
To bad only works on console apps…
Forgive me if the question is silly. Would it be possible to load PHP core library (written in C) into C# and build extensions with it? Or maybe with a PHP-CPP intermediary layer library?
Love your videos, thanks to this one I hadn't stop talking with friends about about how C# can now run naively without the CLR and JIT.
They all respond with "then you don't know what's a managed language" until I pull this video.
I think it's a game changer
Haven't they been announcing AOT for Blazor/ WASM too? I tried it once, it took very long to compile… and finally didn't work.
Very interesting. Comming from Commodore 64, Amiga, all native machinecode and then forward through C/C++, then now… C# and… Docker… and now we can get back to natively compiled code… I still love .NET for its scalability, but cool to know we can also bake and compile our code
Hey man, how about write the exact same thing in C/C++ or Delphi and compare perf and memory footprint?
Because it's norm for me to pick a native code language when anything with client-side high performance is concerned.
Without supporting reflection.emit, does that mean EF lazy loading is out?
Previous self-contained compilation was the NGEN?