Menu

#1054 NativeImage CA never runs

v3.0
closed
pmarcu
2012-09-15
2007-12-11
Doug Semler
No

When installing an application and calling ngen, the custom action ngen fails. The reason for this seems to be the CA scheduler's use of the MsiAssembly table to determine whether the assembly to be ngen'ed is installing into the GAC. The scheduler is examining MsiAssembly.File_Manifest to determine the assembly's installation status into the GAC; however, MSDN states that the determination is made by the MsiAssembly.File_Application column. When no manifest is specified for non-gac'ed assemblies, the scheduler incorrectly thinks that the assembly is being installed into the GAC, thus causing the ngen to ultimately fail.

Workarounds seem to be to ensure an application base is specified in the NativeImage element, or to ensure that a manifest is specified for assemblies not in the GAC.

Discussion

  • mafelt

    mafelt - 2008-01-09

    Logged In: YES
    user_id=1977613
    Originator: NO

    Was the 'AssemblyApplication' attribute used in the assembly's 'File' tag? Can a sample WiX file/snippet representing the problem be attached to this bug report?

     
  • Doug Semler

    Doug Semler - 2008-01-31

    Logged In: YES
    user_id=1342505
    Originator: YES

    Yes, the AssemblyApplication attribute was set for the File element; and, as directed by the Wix docs, not set for the NativeImage element. However, the AssemblyManifest tag was not set (and as far as I can tell doesn't need to be set when the manifest is not external to the assembly).
    Therefore, the File_Manifest column in the MsiAssembly table is empty, but the File_Application table is NOT blank. According to the MSDN documentation, a blank File_Application entry indicates that the assembly is being installed in the GAC, which is born out by experimentation. However, the CA scheduler for the NativeImage examines the File_Manifest column and not the File_Application column (src\ext\NetFxExtension\ca\netfxca.cpp - vcsNgenGac select statement). Therefore, when the File_Manifest column is blank, the command line being run is ngen Strong_Assembly_Name rather than ngen File_Name, regardless of the contents of the File_Application column in the MsiAssembly table. Because of this, the AppBase attribute must be set so that ngen is able to resolve the strong_assembly_name parameter to ngen, regardless of the WiX documentation stating that it otherwise does not need to be set for executables.

    Whether or not the File_Manifest column is correctly populated (by me or wix itself) is, I think, irrelevant, because it still doesn't fix the underlying issue that the column being examnined by the scheduler to determine the fact that an assembly is being GAC'd is incorrect to begin with.

    If you really want I can attach an example, but it is not necessarily trivial, because there are a lot of permutations of the various attributes (File/@AssemblyApplication, File/@AssemblyManifest, NativeImage/@AppBaseDirectory, NativeImage/@AssemblyApplication) that affect the ngen scheduler's selection of command line. In addition, some of the permutations that enable the generator to work properly are not in line with the documentation. And I still can't figure out why the AppBaseDirectory attribute should be set when a DLL is installed to the GAC (according to the docs), since a GAC dll assembly does not necessarily have one single application.

     
  • SourceForge Robot

    This Tracker item was closed automatically by the system. It was
    previously set to a Pending status, and the original submitter
    did not respond within 15 days (the time period specified by
    the administrator of this Tracker).