views:

63

answers:

2

Hi,

i need to install some file to C:\Documents and Settings\currentUser\SomeFolder. I can't find some buildin function/variable for it.

Can someone help/tell me the <DirectoryRef Id="TARGETDIR"> structure or the solution for my problem?

Thanks.

+1  A: 

First, are you sure that you want to do this? You will get a behavior where each user who logs in and starts up your program will attempt to do a repair and ask for the original install if not found. Also when you uninstall you won't be able to clean up all the users profiles.

Many people prefer the "first run" pattern where you have the installer install to C:\Documents and Settings\All Users\ and when you run your program it copies the files to the current user profile if needed ( usually only if you are overriding something that is set for all users ).

Otherwise, here is a list of available directories in Windows Installer / WiX

System Folder Properties: http://msdn.microsoft.com/en-us/library/aa370905(v=VS.85).aspx#system_folder_properties

You'll want to choose from AppDataFolderm, LocalAppDataFolder and CommonAppDataFolder

Christopher Painter
yes i want it. it's for a tool in our team, need to put some files there.
K.Hoffmann
Thanks for the link, the help and a big thanks from the team for a running addin in daily development
K.Hoffmann
A: 

I believe the property you're looking for is PersonalFolder.

However, if you just need to install a few files to that location, I'd probably personally prefer using NSIS because since it's not based on MSI it can be a lot more flexible: for example, as already mentioned you shouldn't install to per-user locations when doing a per-machine installation via MSI. NSIS however is more like a fancy unarchiver with a scripting interface which can be configured to add entries to the Programs and Features control panel applet, so you can avoid the MSI rules.

BruceCran
The property is PersonalFolder not PERSONALFOLDER; property names are case sensitive in MSI. I can write all kinds of ugly script in MSI also but I'm not sure how that's considered a feature or advantage when the goal is to create high quality installers.
Christopher Painter
Fixed.I don't like scripted solutions in MSI either, but it sounds like the OP doesn't want an MSI-based solution: in the past I've used NSIS as a quick hack to get an application onto a developer's machine with all the associated files and registry entries, when I didn't need or want to spend the time authoring a "proper" installer.
BruceCran
The OP tagged the question with WiX ( Windows Installer XML ). The DirectoryRef element that he referenced is a thin abstration over the Directory table in MSI and all of it's associated properties.PS- Once you know your way around MSI you can whip installs together quickly. I once had a developer time me on how long it would take to make an installer that deployed a web service and I came in at 15 minutes built and ready for QA. No defects were ever reported against that installe either.
Christopher Painter