For an ASP.NET MVC application I created a web setup was needed to automate the installation procedure. One of the steps during the installation is a custom dialog which allows you to specify the database connection information.
So I created a class library added an installer class, wrote the code to show the custom form and added the DLL as a custom action to the websetup project. To pass on the installation location to the custom action I use the [TARGETDIR] argument. But no matter what I tried, I always got a filenotfoundexception.
After some investigation I found my answer in the MSDN documentation:
For Windows Installer properties such as [TARGETDIR] that return a directory, in addition to the brackets you must include quotation marks and a trailing backslash: /name="[TARGETDIR]\".
After adding the trailing backslash \ to the [TARGETDIR] property everything works. I’m curious about the reason why they require this…