Showing results for 
Show  only  | Search instead for 
Did you mean: 
Level 2

issue in Pre compiling .net assemblies using NGEn 2.0

Hello All,

I am experiencing issues in using pre compiling .3 net assemblies by setting property .Net Precompiled to "Yes".

When I do this, two custom actions were created with incorrect options i.e install and delete does not came itself. This causing issue while installation.

I have tried modifying but still does not work.

I have searched some of posts in this site, but bringing this question again, do we have any solution. Please point to the relevant post.

Labels (1)
0 Kudos
(1) Reply
Level 10

Hi there,

We faced the same issue a few years ago.
The assembly precompilation during installation is a buggy feature that has not been fixed since it was integrated in InstallShield.

We ended up implementing our own mechanism to queue the assemblies in the ngen queue. So we now have a simple way to add components to a list of assemblies that will be added to the precompilation queue. If we want to precompile one assembly that we install, all we need to do is add it to one custom table.

Here is a brief description:

  • Add an NGenAssembly table.
    The key column is "Component_" which points to the first column of the "Component" table.
    The other columns nearly map 1:1 to the options of ngen.exe

  • For installation

    • Add a custom action (scheduled for immediate execution) that iterates through this table, and add all assemblies to a list with the relevant options for ngen.
    • Add a custom action (scheduled for deferred execution) which uses the list you previously created. This custom action will actually call ngen with the relevant options for every listed item.
    • Add a custom action (scheduled for rollback execution) which remove the assemblies from the ngen queue. This is needed because you need to be able to rollback any action that modified the target system.

  • For deinstallation

    • Create 3 custom actions that do nearly the opposite from the ones above.

It took me a while to implement it, but it was worth it, as I can now simply add or remove assemblies to the precompilation list by adding rows to the NGenAssembly table.

I wish the InstallShield team had thought of such a mechanism instead of creating buggy custom actions.
0 Kudos