没有Office PIA会如何影响PowerPoint加载项的性能? [英] How does the absence of office PIA affect the performance of PowerPoint Add-in?

查看:94
本文介绍了没有Office PIA会如何影响PowerPoint加载项的性能?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想知道缺少Microsoft.Office.Interop.PowerPoint dll对PowerPoint加载项性能的影响.

I want to know the impact of absence of Microsoft.Office.Interop.PowerPoint dll on the PowerPoint add-in performance.

假设在开发msi软件包期间已删除了用于查找用户计算机上是否存在PIA的启动条件.​​

Assume that the launch condition to look for the presence of PIAs on user's machine has been removed during the development of the msi package.

谢谢.

推荐答案

PIA与性能无关.它仅包含声明,[ComImport],用于Office对象模型中的接口和共同类. CLR需要他们知道如何打电话给他们.

A PIA doesn't have anything to do with performance. It only contains declarations, [ComImport]s for the interfaces and co-classes in the Office object model. The CLR needs them to know how to make a call to them.

可能需要PIA .它解决了.NET类型标识问题,CLR坚持认为,只有当它们来自同一程序集时,它们才是相同的. PIA是一个组件.请注意,这在外接程序中并不常见,通常只创建一个程序集.

A PIA could be necessary in the olden days if one of your public classes exposes Office types. It solves the .NET type identity problem, the CLR insists that types are only identical when they come from the same assembly. The PIA is that one assembly. Note that this is not a common thing to do in an add-in, you typically create only a single assembly.

PIA已过时,已在.NET 4.0和VS2010中彻底,优雅地替换. v4 CLR有一个有关类型标识的新规则,如果[ComImport]类型具有相同的[Guid],则认为它是相同的,而不管它来自什么程序集.它为新的参考部件属性提供了动力,您可以在属性"窗口中找到它,名为嵌入互操作类型".默认为True.

PIAs are obsolete, thoroughly and elegantly replaced in .NET 4.0 and VS2010. The v4 CLR has a new rule about type identity, a [ComImport] type is considered identical if it has the same [Guid], regardless of what assembly it came from. Which powers the new reference assembly property, you find it back in the Properties window, named "Embed Interop Types". With a default of True.

这是告诉编译器在您的程序集中嵌入[ComImport]声明.就像您自己在源代码中声明它们一样.最大的好处是,您完全失去了对Microsoft.Office.Interop.PowerPoint interop程序集或PIA的运行时依赖.而且,您只需为在程序中实际使用的互操作类型付费,Office PIA相当大.

What that does is tell the compiler to embed the [ComImport] declarations in your assembly. Just as though you had declared them yourself in your source code. With the big, big advantage that you completely lose the runtime dependency on the Microsoft.Office.Interop.PowerPoint interop assembly or the PIA. And you only pay for the interop types that you actually use in your program, Office PIAs are pretty big.

这没有负面影响.如此之多,以至于Microsoft不再提供Office 2013的PIA.

There are just no down-sides to this. So much so that Microsoft does not ship the PIAs for Office 2013 anymore.

可能性很高,您已经在使用嵌入互操作类型"功能.考虑到您的加载项有效,如果您仍然对其依赖,它将崩溃并刻录.尽管从技术上讲,您可能会取决于其他人的好意.确保可以查看Microsoft.Office.Interop.PowerPoint参考的属性"窗口.

So high odds that you are already using the Embed Interop Types feature. Considering that your add-in works, it would crash and burn if you still had a dependency on it. Although technically you could be depending on the kindness of others. Check the Properties window for the Microsoft.Office.Interop.PowerPoint reference to be sure.

这篇关于没有Office PIA会如何影响PowerPoint加载项的性能?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆