Native Compilation for C# desktop apps
Asked Answered
C

1

6

I have a C# desktop application.

I would like to compile it into native code for speed execution and add a level of protection to my code.

I notice that MS offers this for Window Apps? But not desktop Apps?

I have also heard (somewhere) that I could use Mono which would do the native compilation. Is that true? If so, would using 3rd party tools like Aforge.Net and EMGU be a stopping point?

Thanks

Chile answered 6/11, 2014 at 12:56 Comment(8)
Are you looking for ngen?Paleoasiatic
@FrédéricHamidi HI, useful link! A quick look.. does this mean I can compile on the command line? thanksChile
Note that ngen will remove the JIT compilation step, but it will still be running in the CLR, and the IL still needs to be present.Bebeeru
So, a side question here then.. I have used a decompiler for VB6 and apart from strings it was not very informative. Now, If I used Resharper on an EXE written in C# I can see all my code. I know if someone is determined to look at my code they will eventually but am I right in saying that compiling to native will make that process a bit more difficult? However, my main aim is quicker app execution.Chile
Hmm, the kind of "protection" you are asking about used to be provided by .NET linkers. Like Remotesoft's Salamander. Few programmers survived the sticker-shock, north of a thousand bucks for a single-use license. They all gave up around .NET 2.0. Obfuscators are still common.Demesne
Such a shame. I do obfuscate my code but Resharper manages to dissemble it. Such a shame there no alternatives. So, native compilation just makes start up quicker for the app or does it make it quicker through-out do you know?Chile
@AndrewSimpson: forget about obfuscation. If your code is so valuable it's worth someone's time to decompile it, then no amount of obfuscation is going to stop them. You need to turn that kind of code into a web service and host it in a protected environment. Much more typical is that the owner of the code over-estimates the code's value, and doesn't really need to protect the code at all.Photooffset
@PeterDuniho Hi, yes. I do not believe my code is that valuable and what I can move to the server I have done so. There is one technique that I want to protect and that is about 3 lines of code. I know all the reasons why client side wild never be protected but I live in hope of finding a unique way of doing so (I will patent that and be very rich! lol). But back in the real world I wanted to not just serve it on a plate to everyone. Still...Chile
B
2

If you're writing an app for Windows 10 UWP, you can now use Microsoft .NET Native to AOT compile your app into native code.

Baumgardner answered 22/7, 2016 at 19:2 Comment(1)
Hi I was not but I could do so. So this will work - thanksChile

© 2022 - 2024 — McMap. All rights reserved.