在混合模式DLL中链接到presentationcore.dll [英] Linking to presentationcore.dll in mixed mode DLL
问题描述
我们有一个用C ++编写的混合模式DLL,它包装了本机C ++ DLL并公开了托管类.在公开的托管类中,我们使用Vector3D等类型的方法参数,它们是PresentationCore.DLL的一部分.
We have a mixed mode DLL written in C++ which wraps native C++ DLLs and exposes managed classes. In the exposed managed classes, we use method arguments of type Vector3D etc., which are part of PresentationCore.DLL.
因此,混合模式C ++代码需要引用PresentationCore.DLL.我们通过
Therefore, the mixed mode C++ code needs to reference PresentationCore.DLL. We do this via
#using <PresentationCore.dll>
这需要项目的搜索路径包含其中存在PresentationCore.dll的文件夹.
which requires the project's search path to include the folder PresentationCore.dll lives in.
这很糟糕,因为这些文件夹在不同的计算机上有所不同,并且我们的项目需要在多台计算机上进行更改而无需更改.目前,我们已通过在代码存储库中包含PresentationCore.dll的副本来解决此问题,这显然不是一个好的解决方案.
This is bad, because these folders vary on different machines, and our projects need to compile without changes on several machines. At the moment, we have solved this by including a copy of PresentationCore.dll in our code repository, which is obviously not a good solution.
对于我们如何绕过指定应该通过GAC可以完全访问的DLL的显式路径的建议,我将不胜感激.
I'd be grateful for suggestions how we can get around specifying an explicit path to a DLL that should be perfectly accessible via GAC.
推荐答案
请勿执行#using <PresentationCore.dll>
.您需要右键单击该项目,转到References...
,单击Add New Reference...
,然后从.Net
选项卡中选择PresentationCore
.我得到的提示是:
Don't do #using <PresentationCore.dll>
. You need to right click on the project, go to References...
, click Add New Reference...
and pick PresentationCore
from the .Net
tab. I got the hint from:
http://msdn.microsoft.com/en-us/library/aa970266.aspx
这篇关于在混合模式DLL中链接到presentationcore.dll的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!