Question

i created a simple application , and i read in a book that the C# or any .net program is converted to an assembly file contains assembly code , but i`d like to know where to locate that assembly file .

Était-ce utile?

La solution

All C# programs (and more generally, any .NET language) are converted to a .NET "Assembly", which is an .exe or .dll that contains intermediate bytecode - CIL. That bytecode is compiled down to machine langauge when you run your program on-the-fly by the JIT compiler.

By default, Visual Studio will place the .NET Assemblies in your project's /bin folder, and then the chosen configuration under that. (by default only 2 exist, /bin/Debug and /bin/Release) You can change this in the project properties.

There is no assembly code in a .NET assembly, but you can view the CIL bytecode with tools like ildasm.exe or Mono.Cecil.

The JIT compiler has the benefit of being able to detect the system's current hardware configuration and apply optimizations based on the CPU's features. There would be no purpose in looking at the stuff the JIT generates, as that will be different from computer to computer.

Autres conseils

You'll need to be careful about terminology.

.NET binaries are called "Assemblies" and these do not contain assembly code (assuming by assembly code you mean actual machine instructions). Instead it contains CIL which looks similar to Assembly language for a wacky CPU. Prior to execution, CIL is Just-in-time compiled to native Assembly for the platform, and run.

If you're building a debug build, bin/Debug is where your assemblies will be. For release it's in bin/Release

Note that these directories are relative to your Visual Studio Project location.

You can create two types of ASP.NET Assemblies in ASP.NET: private ASP.NET Assemblies and shared assemblies. Private ASP.NET Assemblies are created whey you build component files like DLLs that can be applied to one application. Shared ASP.NET Assemblies are created when you want to share the component files across multiple applications. Shared ASP.NET Assemblies must have a unique name and must be placed in Global Assembly Cache (GAC). The GAC is located in the Assembly directory in WinNT. You can view both the manifest and the IL using ILDisassembler (ildasm.exe).
ref:http://www.dotnet-guide.com/assemblies.html

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top