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
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"];
Installer Class have many limitations and behave very poorly when they fail ( fragile ). I suggest you look at C# managed custom actions using Deployment Tools Foundation (DTF) in Windows Installer XML ( WiX ). The output of this project type is C++ equiv and can be consumed by a Visual Studio Setup and Deployment Project ( which I also wouldn't reccomend using. )
精彩评论