从 Excel 加载依赖的 DLL
我们有一个库(XLL 文件),我们通过 RegisterXLL 方法通过 Excel 自动化从 C# 代码将其从网络驱动器加载到 Excel。最近我们切换到 VS2010,现在我们的库不再使用单个 xll,而是还需要加载 msvcp100.dll 和 msvcr100.dll(我们在依赖项遍历器中看到它)。
如果PC上安装了VS2010,那么这些文件都在C:\WINDOWS\system32\文件夹中,但对于普通用户来说,情况并非如此。而且我们不能在它们之间分发这两个文件。 如果我们将这些文件放入同一网络文件夹中,则不会从那里加载它们。 有没有什么方法可以强制Excel在我们加载库的同时加载这些文件?
We have a library (XLL file) which we load from network drive to Excel via RegisterXLL method through Excel automation from C# code. Recently we switched to VS2010, and now instead of having single xll for our library it requires msvcp100.dll and msvcr100.dll to be loaded as well (we see it in dependency walker).
It is OK if PC has VS2010 installed, then these files are in C:\WINDOWS\system32\ folder, but for regular users this is not the case. And we can’t distribute these two files among them.
If we put these files into the same network folder, they will not be loaded from there.
Is there any way to force Excel to load these files at the same time when we load our library?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这些文件是 MS C 运行时。
如果您不想重新分发它们,那么您应该使用静态链接。您可以使用 /MT 链接器选项获得静态链接。
另一方面,安装可重新分发的运行时并没有什么真正的麻烦。事实上,您之前应该在旧版本的 Visual Studio 中这样做,但您没有这样做,因为其他一些程序之前可能已经安装了它。
These files are the MS C runtime.
If you don't want to redistribute them then you should just use static linking. You get static linking with the /MT linker option.
On the other hand, its no real trouble to install the runtime re-distributable. In fact you should have been doing so before with your older version of Visual Studio, but you were getting away with it because some other programs would have installed it before.