Search code examples
c#windows-installermanagedinstallerclass

How to get the msi path within installerclass in C#


I would like to know the path where the msi is located whithin the InstallerClass that I use as a custom action in the setup.

I tried using properties like path, SrcDir etc. in Context.Parameters, but those values do not exsist (Throws NullReferenceException). Is there any other way way of getting that path or any reason why those values are null???

Thanks


Solution

  • You will need to pass the relevant property in action data via the Property window in VS:

    /sourceDir="[SourceDir]\"
    

    Then, use the context to retrieve it:

    string path = Context.Parameters["SourceDir"];