I am able to run the following in the cmd console and it works. I can see the difference when the app is loading and when executing task within.
C:\Windows\Microsoft.NET\Framework64\v4.0.30319\ngen.exe install "C:\Program Files (x86)\App Directroy\App.exe"
I am trying to have Inno perform the same when installing the app but, before the user has an opportunity to launch the app for the first time.
This is what I have tried so far with Inno:
[Run]
Filename: C:\Windows\Microsoft.NET\Framework64\v4.0.30319\ngen.exe; Parameters: "install ""{app}\{#MyAppExeName}""";
Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: nowait postinstall skipifsilent"
What happens is that, when Inno finishes installing it starts the app and doesn't execute the ngen.
I am trying to find how to run the above code in the Inno script.
Am I placing the code in the correct section of the Inno script?
Any assistance is appreciated.
Regards,
I read what Martin Prikryl said about the hard-coded c:\windows... and looked into it and I found this article from Fabrizio Stellato and I was able to get it to work.
I changed this part:
[Run]
Filename: C:\Windows\Microsoft.NET\Framework64\v4.0.30319\ngen.exe; Parameters: "install ""{app}\{#MyAppExeName}""";
to
[Run]
Filename: "{win}\Microsoft.NET\Framework64\v4.0.30319\ngen.exe"; Parameters: "install ""{app}\{#MyAppExeName}"" /nologo"; WorkingDir: "{app}"; Flags: runhidden; StatusMsg: "Optimizing..."; Check: IsWin64
I added the {win} to replace the hard coded c:\windows
I hid the cmd console with Flags: runhidden;
Show the status to the user with StatusMsg: "Optimizing...";
Fabrizio Stellato has a complete solution:
Part 1 InnoSetup, optimize your application with ngen
Part 2 InnoSetup, Optimize your .NET Application with ngen - Part II
Regards,