Saturday, March 29, 2008

Custom Actions With .Net Installer Class Yields Weird Error

The Error

The other day I was writing a custom installer for some SharePoint stuff. I ended up customizing the UI a little and mapping those user inputs to properties that I would refer to some custom actions class that I wrote.

I was following a tutorial on the web and everything seemed to be going fine until I added all my properties, ran the installer and then bam!

Low to my surprise, when I ran the installer I ended up getting an error of the form:

Error 1001. Exception occurred while initializing the installation: System.IO.FileNotFound: Could not load file or assembly 'file:///[path]' or one of it's dependencies. The system cannot find the file specified.

I ended up digging around on the web for a bit and couldn't really find anything, so after I fixed it I decided that this gotcha might deserve to be immortalized in a blog entry.

The Solution (at least for me)

The fix was of course something silly. I'm almost embarrassed. When you pass custom properties that are file paths that include spaces in them (ie. 'C:\Program Files\...') you need to wrap the whole path in quotes, this goes for custom properties too.

Further more if you're passing in the path of the installation directory (TARGETDIR) you need to not only wrap it in quotes but also put a back slash on the end of it.


There's more information on the MSDN.

So I fixed my custom action expressions by wrapping them in quotes (and putting a trailing backslash on [TARGETDIR] AND I'm good to go! No more angry error.Putting quotes (

Maybe next time I'll RTFM.



Anonymous said...

Old post but still very useaful, thanx! :)

electronic signature pad said...

I really liked this post. You explain this topic very well. I really like your blog and I will definitely bookmark it! Keep up the super posts!

for ict 99 said...

Hi, Great.. Tutorial is just awesome..It is really helpful for a newbie like me.. I am a regular follower of your blog. Really very informative post you shared here. Kindly keep blogging. If anyone wants to become a .Net developer learn from Dot Net Training in Chennai. or learn thru Dot Net Training in Chennai. Nowadays Dot Net has tons of job opportunities on various vertical industry.
or Javascript Training in Chennai. Nowadays JavaScript has tons of job opportunities on various vertical industry.

for ict 99 said...

IEEE Cloud computing DOamin is a general term for anything that involves delivering hosted services over the Internet. IEEE Projects on Cloud Computing The cloud is a metaphor for a global network of remote servers which operates as a single ecosystem, commonly associated with the Internet. IEEE FInal Year Project Domains Final Year Projects for CSE cloud computing is the delivery of computing services—including servers, storage, databases, networking, software, analytics, and intelligence

JavaScript Training in Chennai

JavaScript Training in Chennai