I'm bundling the ngen.exe for .net 2.0 and .net 4.0 with my .net 3.5 application inside NSIS installer. I don't find any other method to do it so i'm bundling it.
I have following in my app.config file.
<startup useLegacyV2RuntimeActivationPolicy="true">
<supportedRuntime version="v4.0"/>
</startup>
I'm also using other app.config which doesn't have code from above. Other app.config only used when there is .net 3.5 installed on pc. my question is which version of ngen.exe should i use if user doesn't have .net 3.5 installed?
You cannot "bundle" ngen.exe, it is not allowed. The license specifically disallows it, read redist.txt in the VS install directory.
This is not just to make your life difficult, this is to stop you from making a mistake. With an .exe.config file like this, you demand that the app runs with .NET 4, regardless of what it was built against. You are asking to use the v4.0 jitter so only the v4.0 version of ngen.exe is appropriate. Which is already installed on the machine so "bundling" is not necessary. If it isn't installed then running the app won't work either.