Question

I have a plain old Windows Forms application with a WiX installer, and it is installed for all users to the Program Files folder as you would expect. The application hosts add-ins using the System.AddIn framework.

Because the System.AddIn framework needs to write to some of the add-in pipeline folders (AddIns, AddInSideAdapters, AddInViews, Contracts and HostSideAdapters) I don't know the best place to install the add-ins to. I can't install to Program Files because the user won't have write permission, and if I install to the user's Application Data folder then the add-ins won't be installed for any other users.

I realise that there are conflicting requirements here (users can't mess with other users' add-ins, the add-ins need to be installed for all users and all users need permission to write) but what is the best practical route to take?

It's a shame that the files the System.AddIn framework needs to write can't be stored separately in Application Data, but that seems to be a limitation of the framework.

Was it helpful?

Solution

I know this question was asked a long time ago, but...

Have you tried Environment.SpecialFolder.CommonApplicationData?

In Vista/Windows 7, this folder is: %ProgramData%. I'm not 100% sure what it is in Windows XP, but it's probably %ALLUSERSPROFILE%.

In any case, this folder should have permission to read/write and be the same for all users.

Don't forget to create a subfolder for your company/application name:

string companyName = "My Company";
string folderPath = Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData);
string path = Path.Combine(folderPath, companyName);

OTHER TIPS

Still hoping for a better answer, but I think the only way to do it is to install the pipeline to Program Files and copy to Application Data each time the application is run. You would then point System.AddIn framework to the pipeline copy in Application Data so it only attempts to write to the user profile.

Uhh, you can't have both "all users" and "no elevation". I don't exactly know what the System.AddIn framework is but if it is intended to be run from a user process (aka: not a system service like process) then it must write under the user profile (ApplicationDataFolder is a great place). That is a very fundamental rule that all applications must follow. Based on my limited understanding from your comments, it sounds like the System.AddIn framework is breaking that rule.

But I'm probably just missing something.

Are you required to use the WiX installer? Deploying your app as a clickonce solution will put all of the pipeline into the users application data folder. This way each user can keep their own list of modules.

This will also get around the writeable folder restriction.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top