11
Once compiled a C# code depends on the . NET Framework installed on the machine to run, similarly to Java?
11
Once compiled a C# code depends on the . NET Framework installed on the machine to run, similarly to Java?
10
Today no longer, even if it depends on a Runtime, as essentially every language depends, of course C# requires a Runtime a little heavier because you need to manage memory, threads security and other things besides owning a very strong library.
Almost always can use the Mono which is not the . NET Framework and does not need to be installed on the machine. It has its disadvantages there, but works well.
Now you have the .NET Core which also does not need to be installed beforehand, with it essentially gets free of dependencies, so it already solves what you want. Of course it has limitations, it doesn’t run everything . NET Framework runs, so you have to see what you need.
Also has the .NET Native which is like a program done in C or C++. It still doesn’t run everything, but it’s evolving. But by 2020 it’s relegated and the future is the whole. NET 5 which is Core.
Running well depends on the programmer doing right. It takes a little work, but done right goes well. Doing right and according to the needs is a task for the developer to solve. It may take a little more work, but it is doable.
Important to say that most C or C++ applications need a Runtime that is already in the operating system, some with version difficulties, has no miracle, without any dependency does not exist, at least in "normal operating systems".
4
I don’t know anything that doesn’t require a dependency to run. Only if this dependency is compiled together with the application.
If you intend to deliver your application to Windows environments, the system already comes with the framework installed. Your biggest concern would be which version of . NET would use in your application. You can see here which version of . NET Framework comes out with each version of Windows.
If it is an installable application, you can add the . NET Framework in the desired version to your installer.
All that I said is nullified if you want a web solution with ASP.NET (and variants). In the client-side o . NET is not required, only on the server. The only dependency would be the browser, but I hope it will not bother you.
0
"Programs written in C# depend on the . NET Framework to run?" The question is half open, but generally speaking and using the standard architecture, Yes. To run the applications done in c#, you accurate of the . net Runtime.
When you create an application in C++ and use gcc to compile, you usually generate native code, that is, a specific binary for the platform (processor and OS) you are using.
When you program in c# and compile, you generate an intermediate language called IL (similar to byte code in analogy) and this in turn is compiled and executed at runtime by the environment of . net.
This same environment performs memory management for you, this is one of the main reasons to use a platform like this, there are several security problems linked to simple memory management, not to mention bugs. Something like the c++ Smart Pointers, but these are more connected to the immediate scope, in environments managed with the . net, a heuristica is used to control the actual moment when the memory blocks are displaced, you can ask, but the specification does not guarantee that the Garbage Collector will perform the collection when you asked, he who chooses the most suitable time to wipe the memory you are no longer using. Logically this applies to what we call managed code, you can also invoke native code (Win32) within an application. net, ai the thing follows the normal flow of things. You can call a dll made in c++ within a code in c#.
The Windows executable format is the PE format, in it are the headers that allow the operating system to run and manage the memory space of the applications, as I recall, some fields were inserted in the PE format headers that allow the OS to know if the file is an executable for the . net and underneath the scenes, call the framework or request its installation.
These facilities, as well as the fact that frameworks usually come with Windows, end up generating confusion about the need or not of Runtime, but, it exists and is there for you.
The Runtime compiler (JIT) is intelligent and for performance reasons, it keeps a cache of codes and instructions that have already been compiled to improve performance.
The fact that the executable code is an intermediate language also leads us to the fact that it can be read and 'decompiled' more easily, this is one of the reasons for the existence of obfuscators that hinder the reading and decompilation of intermediate code.
An interesting point to discuss is that generally, there are bigger complications than what you are having in choosing a language, for an application to work, as has been said, there is no way not to have a dependency on API, OS or third party code (legacy code is quite common).
My time working with . net taught me more to be careful with third-party binaries and dependencies, in some rare cases, the Framework version. But, given your question, my suggestion is to check the platform for which you intend to develop, the . net goes well beyond c# or clr and is an integrated platform at various levels of solution, but is logically much more mature in its potential when targeting the Microsoft product platform.
References:
Someone explain to me the -1 ?
0
There are alternatives that do not require the . net framework.
The turbo.net studio eliminates the depedence of the .Net. framework. Of page of their Features is written as follows
Eliminate . NET and Java Dependencies
Run . NET, Java and AIR-based Applications with no Separate installation Steps or Runtime versioning Conflicts. The Turbo virtual machine Supports all versions of the . NET Framework and Java, including . NET 4.0, 4.2, and 4.5.
Free Translation:
Eliminates. NET and Java depedences
Run . NET, Java and AIR-based applications without requiring installation additional and non-confrontational versions of Runtime. The turbo virtual machine supports all verses of the . NET Framework and Java, including . NET 4.0, 4.2, and 4.5.
While this link may answer the question, it is best to include the essential parts of the answer here and provide the link for reference. Replies per link only can be invalidated if the page with the link is changed. - Of Revision
@Júniormoreira Feito.
-3
But of course it depends https://docs.microsoft.com/pt-br/dotnet/csharp/getting-started/introduction-to-the-csharp-language-and-the-net-framework, early on C# was called J++, microsoft wanted a language that resembled java, but due to the legal dispute with SUN it switched to C# and depends entirely on . NET as well as Java depends on JVM
C# was never called J++. and it seems to me that this does not answer what was asked.
Browser other questions tagged c# .net installation
You are not signed in. Login or sign up in order to post.
@vnbrs But what I want to understand is: is there any way to make the program in a way that does not depend on . NET Framework? I want to start studying C#, but there are dependencies to run the programs, I won’t. I want something more "plug and play".
– Seu Madruga
@vnbrs But this way there may be problems of incompatibility, don’t you think? I’ve installed programs that requested a specific version of . NET to run.
– Seu Madruga
@sincerity, not ... summarizing in a general way.
– novic
Link useful for reflection: https://stackoverflow.com/questions/29609993/difference-between-net-framework-4-6-net-native-and-net-core
– novic
Honestly, compiled code for specific architecture and OS has nothing to "plug and play", writing portable code is something that requires extreme discipline and is not trivial.
– Intruso