[System.AddIn] store files

M

Mike Hudgell

I've been developing an app based around using System.AddIn to build a
pipeline of add-ins...I've been doing this on XP which is fine, but now
trying it on Vista it complains about:

Access to the path 'C:\Program Files\[...]\Pipeline\PipelineSegments.store'
is denied.

Now I understand this is because in the 'standard user' setup nothing should
be writing within Program Files, but how do I re-direct system.addin to
cache elsewhere for these files?

Mike
 
J

Jie Wang [MSFT]

Hello Mike,

Thank you for posting your question.

The default path of the root of the pipeline directory structure is
AppBase, which resides in Program Files in your case. If you want to change
the default path, you can use "AddInStore.Update Method (String)" and
"AddInStore.Rebuild Method (String)" to specify your own path for pipeline
root directory. The online document for these two methods are here:
http://msdn.microsoft.com/en-us/library/bb352340.aspx
http://msdn.microsoft.com/en-us/library/bb355338.aspx

So you can store your add-in information in system specified directory like
CommonApplicationData (use Environment.GetFolderPath to get the real path
to it). This is a better practice because we usually don't write things
into Program Files in Vista.

Another approach is to still use the default directory, but when writing to
the add-in cache, you can launch an external process elevated (in Vista or
2008) so that process will have full access to the Program Files directory.
However, this approach will need lot more time & efforts to implement.

If you have any further questions regarding this issue, please do let me
know and I'll be happy to help.

Regards,

Jie Wang ([email protected], remove 'online.')

Microsoft Online Community Support

Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
(e-mail address removed).

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/en-us/subscriptions/aa948868.aspx#notifications.

Note: MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 2 business days is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions. Issues of this
nature are best handled working with a dedicated Microsoft Support Engineer
by contacting Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/en-us/subscriptions/aa948874.aspx
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
 
M

Mike Hudgell

"Jie Wang [MSFT]" said:
[snip]
So you can store your add-in information in system specified directory
like
CommonApplicationData (use Environment.GetFolderPath to get the real path
to it). This is a better practice because we usually don't write things
into Program Files in Vista.

Would that not mean that all the code in the add-ins is then in a much less
trustworthy location on the PC?

Is there no way of just moving the 'cache' files that System.AddIn creates
to the new location?

Mike
 
J

Jie Wang [MSFT]

Would that not mean that all the code in the add-ins is then in a much
less
trustworthy location on the PC?

Hi Mike,

I'd like to share my point of view about "trustworthy". By default, the
assemblies located on local computer are granted the Full Trust permission
set. So putting add-in assemblies in the ProgramData folder really doesn't
make any differences to putting them in the ProgramFiles, in assembly's
Evidence point of view (unless you manually make a permission set that
tells CLR the ProgramData folder should be less trustworthy). Besides, if
we sign the add-in assemblies with stong names, we don't need to worry
about them being tampered either.
Is there no way of just moving the 'cache' files that System.AddIn creates
to the new location?

If you mean the "cache" files for add-ins, then the answer is no.

The add-in assemblies always stay with the AddIns.store in current version.
We can find this out using the .NET Reflector tool and dig into
System.AddIn.Hosting.AddInStore class, from its private static method
"BuildAddInCache" code:

WriteCache(state, rootDir, "AddIns.store", now);

where the rootDir is the root directory for the add-ins. And in the
WriteCache method, it just uses Path.Combine to get a full path to the
cache file.

However, the pipeline segments cache file and the add-in cache files
needn't to be under the same root directory, as we can find out in the
RebuildAddIns / UpdateAddIns methods' references. We can specify seperate
paths for them.

So if your application's spec says the users don't need an Administrator
credential to add / remove / update add-ins, putting the add-ins in
ProgramData would be a better choice. If your application's spec says a
user must be an Admin to add / remove / update add-ins, then I'd just put
the add-ins in the ProgramFiles folder just like now, and users have to run
the application as Administrator to make changes to the add-ins.

Please let me know if this address your concerns, and I'm always ready to
help.

Thanks,

Jie Wang ([email protected], remove 'online.')

Microsoft Online Community Support

Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
(e-mail address removed).

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/en-us/subscriptions/aa948868.aspx#notifications.

Note: MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 2 business days is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions. Issues of this
nature are best handled working with a dedicated Microsoft Support Engineer
by contacting Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/en-us/subscriptions/aa948874.aspx
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
 
J

Jie Wang [MSFT]

Hi Mike,

Haven't heard from you for some days. How's going? Is the problem solved?

If you got any further questions, please let me know and I'll be happy to
help.

Thanks,

Jie Wang ([email protected], remove 'online.')

Microsoft Online Community Support

Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
(e-mail address removed).

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/en-us/subscriptions/aa948868.aspx#notifications.

Note: MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 2 business days is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions. Issues of this
nature are best handled working with a dedicated Microsoft Support Engineer
by contacting Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/en-us/subscriptions/aa948874.aspx
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
 
M

Mike Hudgell

Hi Jie,

Another of our tech guys is actually implementing the changes, and it all
looks promising but we shall see when I get it installed on Vista...

I will post further comments if it doesn't work...

Mike
 
J

Jie Wang [MSFT]

Cool!

Please do let me know if it works.

Thanks,

Jie Wang ([email protected], remove 'online.')

Microsoft Online Community Support

Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
(e-mail address removed).

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/en-us/subscriptions/aa948868.aspx#notifications.

Note: MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 2 business days is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions. Issues of this
nature are best handled working with a dedicated Microsoft Support Engineer
by contacting Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/en-us/subscriptions/aa948874.aspx
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
 
M

Mike Hudgell

That works fine... We left the pipeline stuff in Program Files and ran an
elevated custom action at the end of setup to create the pipeline file, and
then the user runs as a standard user and creates (and can re-create when
the addins change) the addin.store file as appropriate in CommonAppData

Mike
 
J

Jie Wang [MSFT]

Hi Mike,

It's great to know your solution works! And thank you for sharing it with
the community.

Best regards,

Jie Wang ([email protected], remove 'online.')

Microsoft Online Community Support

Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
(e-mail address removed).

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/en-us/subscriptions/aa948868.aspx#notifications.

Note: MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 2 business days is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions. Issues of this
nature are best handled working with a dedicated Microsoft Support Engineer
by contacting Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/en-us/subscriptions/aa948874.aspx
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top