[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework.interop

Office 2007, Office 2003, Vista, interop and publisher policies

Willy Van den Driessche

7/31/2007 11:48:00 PM

I have a large application that does (some) interop with office 2003. I
deploy this app via clickOnce to my customers.
I have now installed Visio 2007 (because I needed a drawing and I wanted to
see what Office 2007 looks like without disturbing the office applications
and because I wanted to use my MSDN account for more than Visual Studio).

I added a feature (more like "fixed a 'feature'") to my app and redeployed
the app. My customer rang me and complained they now had a message box :

*Unable to install or run the application.
The application requires that assembly office Version 12.0.0.0 be installed
in the Global Assembly Cache (GAC) first.
Please contact your system administrator*

It didn't take me ten seconds to realize Visio 2007 was at the root of the
problem. I used Reflector to see what happened and it showed me my app was
using office 11 and office 12 interop assemblies.
Since the reference in my project clearly states office 11 I was stunned for
a moment. Then I realized .NET allows for publisher policies and yes, there
is a publisher policy "Policy.11.0.office.dll" which states (in the
properties) "Publisher policy to load 12.0 assemblies instead of 11.0
assemblies."
I think that's a great idea. This is the .NET way of Microsoft saying that
office 12 is upwards compatible with office 11. What I don't like is that
the compiler uses this information to force my application to include a
reference to office 2007 (which most of my clients don't have - neither do I
for that exact same reason).

So I tried to uninstall the Policy assemblies manually from the GAC. Access
Denied. O yes, this is Vista now, you have to be an administrator. Still
acess denied. If it's installed by an MSI then that MSI will decrement the
reference count, not you. Grumph. Opened the Visio install looking for
what looks like programming and .NET. I now still have 2 policy files left
(unfortunately Policy.11.0.office.dll is among them)

Why this story ? It's my unlucky combination that makes things not work :
- if Microsoft hadden't installed a publisher policy in the GAC, this
wouldn'ty have happened in the first place.
- if the .NET compiler would not have interpreted the policy, things would
have been great.
- if Vista would allow me to uninstall the policy files manually (trust me I
now what I'm doing ...)
- if Visio was still not part of Office ...
-....

If if if. Now I will uninstall Visio 2007 (still need the drawing though)
and install Visio 2003 hoping for better news (If I can still download it
from the MSDN site that is)