Question

Is there any approach to convert an application developed in .NET into a native executable (sources are included)?

Installing the whole framework (up to .NET Framework 3.5 SP1) takes a lot of time - not always the computers are updated from the internet. Is it possible to call NGen in order to produce independent executables?

Thanks

No correct solution

OTHER TIPS

It's not available yet, but the Mono project team are working on an Ahead of Time compiler that will do what you are looking for. The intention is for Mono to work on the iPhone (like Unity) but it should work for all platforms.

Edit: It does support Mono x86, but I'm not sure if they have included the feature that packs in dependent classes yet (though from an interview I heard, it's planned)

Edit 2: Including dependencies is currently supported, thanks Dykam!

No, NGen'd code still needs the framework - it only pre-JITs the code in your own assemblies. It also requires the framework for the CLR itself.

I believe Mono has a static compiler which they're planning on using for the iPhone. I don't know whether that will work on Windows as well though.

There used to be a product called Thinstall which some people used for this. It's now called ThinApp - basically it's application virtualisation. It's commercial, but you may well be able to get hold of a trial version.

Personally I'd be somewhat concerned about any such product - when it comes to deployment, veering away from the mainstream way of doing things sounds like a recipe for lots of support calls. There's just an awful lot to go wrong. I'm not saying it doesn't work, just that I'd be wary.

Have you looked at the .NET 3.5 (SP1) Client Profile? That may help to reduce your installation requirements a little.

With .net 3.5 SP1 it is possible to install a smaller subset of the .net framework. Take a look at this screenshot: Visual Studio Project properties
(source: windowsclient.net)

You can use NGen to make your application a native executable, but it will still be dependent upon the .Net framework.

NGen compiles the exes to native exes, so they do not need to be JIT compiled as they are run. They are still dependant on the framework though.

There are a few commercial companies that do provide products for compiling .net assemblies into standalone exes. Xenocode and vmware's Thinapp. Neither are cheap though.

Some Obfuscators do this, you would have to do it beforehand though (before you ship it to your users). An example is remotesoft's Salamander.

You will only need to install the version of .NET that you are targeting e.g. .NET1.1 or .NET2.0

Edit: If you need to target the 3.5 version you will need to install both 2.0 and 3.5

ILMerge (Free) can combine several assemblies into one, but I don't think that it works with the core runtimes.

In short I think that if you want to run .NET programs you will need the .NET Framework installed.

There is a commercial product that claims to do that here:

http://www.xenocode.com/Obfuscator/

"Deploy .NET applications securely, with no .NET Framework install"

No idea what the drawbacks to this would be though

ThinApp (formerly Thinstall) from vmware. Used to be very expensive, though.

http://www.vmware.com/products/thinapp/

The only product we founded to solve the problem in 2007 was Xenocode Postbuild. From that time we use this product successfully, we use also its pretty good virtualization features.

The only problem is that the version we purchased don't support the Windows 7 (where you don't need to install .net framework to run your program compiled with version < 4.0). So I wrote to Xenocode. They answered

In order to get support for Win 7 you should upgrade to the newest version of Postbuild (now called .NET Obfuscator). Win 7 is not a supported platform for Postbuild 2007.

Why not Ngen.exe? http://msdn.microsoft.com/en-us/library/6t9t5wcf(v=vs.80).aspx

It converts .Net Programs into Native Programs also and you already have it if you have the .Net Framework

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top