an unmanaged app with C#

  • Thread starter Thread starter JKJ
  • Start date Start date
J

JKJ

Short answer: no.

C# apps must run within the .NET framework. You can 'ngen'
the assembly, but the framework must still exist on the
target machine to read all of the assembly's metadata, and
the MSIL still gets deployed with the assembly
regardless. . .

Hope this clarifies things. . .
 
If you have an "ngen" version of an assembly and you have the "ngen" version
of the dependant .NET classes, what is to stop you from extracting the
native code and doing away with the runtime?
A new executable could be created with just the code needed for the app.
For small programs, this might be quite desirable.

Am I missing something?

Oscar
 
I think you missed my point.
I know about the interactions of managed and NGEN'ed assemblies

Just bear with me...

Let's say you start with a managed app.
The app can be NGEN'ed.
It's dependancies are also NGEN'ed.
A utility extracts the native code and generates a NEW unmanaged Windows
App.
The user runs the new app (no CLR used or needed) and never knows that it
started out life as a C# app.

It's not as crazy or impossible as you think.
The major dependancy would be S.W.F which is a pretty thin layer on GDI and
USER and COMMCTRL.
The other dependancy would be S.Drawing which is also a thin layer on
GDIplus.dll

Maybe MS doesn't like the fact that it can and will happen.
That's another argument.
It seems that they have gone out of their way to cripple NGEN'ed assemblies
but as long as there is x86 code there is really no way to prevent it.

The new app created by the utility would be large but not unusably large.
For small apps, it could be useful.

Oscar
 
Back
Top