none
Using [TARGETDIR] to pass data via CustomActionData into .NET custom action throws error! RRS feed

  • Question

  • When I try to pass [TARGETDIR] into a managed dll, I get a IO.FileNotFound exception! The .NET custom action refers to some .NET GAC dlls. Is there any known issue(s) around this usage?
    Monday, March 26, 2007 7:28 AM

Answers

  • If your custom action assembly depends on assemblies that the setup is installing into the GAC, those assemblies won't be in the GAC when your custom action is called. So if this is just a dependency issue then it's unrelated to TARGETDIR. If you get it only when you pass TARGETDIR, I'm wondering if you're using a ServiceInstaller class. In these cases there is already some CustomActionData being passed to the Installer class that you can't see in the IDE, and then when you add yours they seem to get mixed up and a file path ends up being corrupted, causing that exception. This can be seen only if you look at the MSI file with Orca to see the internals.
    Monday, March 26, 2007 8:21 PM
    Moderator

All replies

  • If your custom action assembly depends on assemblies that the setup is installing into the GAC, those assemblies won't be in the GAC when your custom action is called. So if this is just a dependency issue then it's unrelated to TARGETDIR. If you get it only when you pass TARGETDIR, I'm wondering if you're using a ServiceInstaller class. In these cases there is already some CustomActionData being passed to the Installer class that you can't see in the IDE, and then when you add yours they seem to get mixed up and a file path ends up being corrupted, causing that exception. This can be seen only if you look at the MSI file with Orca to see the internals.
    Monday, March 26, 2007 8:21 PM
    Moderator
  • Well!

     

    Then what is the solution to this problem? I want to send the TARGETDIR to my custom installer.

    Tuesday, June 26, 2007 6:25 AM
  • Hey!

     

    I observed this strange behaviour. The setup runs smoothly only if installation folder does'nt have any 'spaces' in it. I mean it will fail if the installation folder is "C:\Program Files\Microsoft\MergeToolSetup\" but it works fine if it is "C:\MergeToolSetup\".

     

    I am able to install all the components perfectly if I specify the installation folder without spaces.

     

    Can anyone address this issue? And is there any way to specify default installation folder?

    Tuesday, June 26, 2007 7:45 AM
  • Hi,

     

    Type /TARGETDIR="[TARGETDIR]" to CustomActionData!

    Tuesday, July 3, 2007 2:26 PM
  • No Luck! It still throws the same error.

     

    Wednesday, August 1, 2007 5:37 AM
  • Try this instead - that other suggestion was close:

    /name="[TARGETDIR]\".

     

    as documented here:

    http://msdn2.microsoft.com/en-us/library/2w2fhwzz(VS.80).aspx

    Wednesday, August 1, 2007 7:40 PM
    Moderator
  • /name="[TARGETDIR]\".

    This fix worked for me, thanks!!

    Nathan Freeman-Smith

    • Proposed as answer by AnoopKGoyal Tuesday, December 30, 2014 3:26 PM
    • Unproposed as answer by AnoopKGoyal Tuesday, December 30, 2014 3:26 PM
    Tuesday, September 30, 2008 9:40 AM
  • /name="[TARGETDIR]\".

    This fix worked for me, thanks!!

    Nathan Freeman-Smith

    It didn't work for me but below one works with me.

    base.Context.Parameters["AssemblyPath"]

    Tuesday, December 30, 2014 3:27 PM