Programs written in C # depend on the .NET Framework to run?

11

Since compiling a C # code depends on the .NET Framework installed on the machine to run, similar to Java?

    
asked by anonymous 27.09.2017 / 02:03

5 answers

10

Today, no matter how dependable a runtime , how essentially every language depends, of course C # requires a runtime a little heavier because it needs to manage memory , threads security and other things, as well as having a very strong library.

You can almost always use Mono that is not the .NET Framework and does not need to be installed on the machine. It has its drawbacks, but it works fine.

Now you have the .NET Core which does not need to be installed beforehand, with it essentially free of dependencies, then solve what you want. Of course it has limitations, it does not run everything that the .NET Framework runs, there it has to see what it needs.

You also have the .NET Native that looks just like a C or C ++ program. It still does not run everything, but it's evolving.

Turning well depends on the programmer doing it right. It does a bit of work but done right goes well. Doing it right and according to the needs is a task for the developer to solve. It might do a little more work, but it's doable.

It is important to say that most applications in C or C ++ need a runtime that is already in the operating system, some with version difficulties, no miracle, no dependence does not exist, less on "normal" operating systems.

    
27.09.2017 / 02:18
3

I do not know anything that does not 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 you 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 overridden if you want a web solution with ASP.NET (and variants). On the client side, .NET is not required, only on the server. The only dependency would be the browser, but I hope it does not bother you.

    
27.09.2017 / 02:27
0

There are alternatives that do not require the .NET framework.

The turbo.net studio eliminates the deployments of the .Net framework. I do not have the slightest idea how it works, because I've never used it. From the features page , the following is written

  Eliminate .NET and Java Dependencies

     

Run .NET, Java and AIR-based applications with no separate   installation steps or runtime versioning conflicts. The Virtual Turbo   machine supports all versions of the .NET Framework and Java,   including .NET 4.0, 4.2, and 4.5.

Free translation:

  

Eliminate .NET and Java dependencies

     

Run .NET, Java, and AIR-based applications without requiring installation   additional and conflict-free runtime versions. The turbo virtual machine   supports all the verses of the .NET Framework and Java,   including .NET 4.0, 4.2, and 4.5.

Font

    
27.09.2017 / 12:02
0

"Programs written in C # depend on the .NET Framework to run?" The question is somewhat open, but in general and using the default architecture, Yes . To run the applications made in C #, you need of the .net runtime.

When you create a C ++ application and use gcc to compile, you usually generate native code, that is, a binary specific to the platform (processor and OS) you are using.

When you program in C # and compile, you generate an intermediate language called IL (similar to the byte code in analogy) and this is used instead is compiled and run at run time by the .NET environment.

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 similar to Smart Pointers in c ++, but these are more closely linked to the immediate scope, in .NET-managed environments, a heuristic is used to control the actual moment the memory blocks are deallocated, you can request, but, the specification does not guarantee that the garbage collector will perform the collection when you asked for it, it chooses the most appropriate time to clean the memory that you are no longer using. Logic that this applies to what we call managed code, you can also invoke native code (Win32) inside a .NET application, then the thing follows the normal flow of things. You can call a dll made in c ++ inside a code in C #.

The executable format of Windows is the PE format, there are headers that allow the operating system to run and manage the memory space of the applications, so remember, some fields have been inserted in the PE format headers that allow the OS know if the file is an executable for .NET and underneath the panels, call the framework or request its installation.

These features, as well as the fact that frameworks usually come with Windows, end up creating confusion about whether or not the runtime needs to be, but it does exist and is there for you.

The runtime compiler (JIT) is intelligent and for performance reasons, it keeps a cache of the codes and instructions that have already been compiled to improve performance.

The fact that the executable code is an intermediate language also leads to the fact that it can be read and 'decompiled' more easily, this is one of the reasons for the obfuscation that makes it difficult to read and decompile intermediate code .

An interesting point to discuss is that there are usually bigger complications than what you are having in choosing a language, for an application to work, as has already been said, there is no way to have an API dependency, SO or third-party code (legacy code is very common).

My time working with .NET has taught me more to beware of 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, .NET goes well beyond C # or clr and is an integrated platform at several levels of solution, but it is logically much more mature in its potential when it comes to the Microsoft product platform.

References:

Managed Code - Microsoft / p>

.net Architecture Components

    
27.09.2017 / 05:43
-3

But of course it depends link , early in C # was called J ++, Microsoft wanted a language that resembled java, but due to legal disputes with SUN it changed to C # and depends totally on the .NET as well as Java depends on JVM

    
27.09.2017 / 13:53