从经常更新的第三方项目引用dll

时间:2017-08-08 18:45:29

标签: c# .net winforms dll .net-assembly

我是.net的新手,可能还没有完全理解这些概念。我知道这是一个非常古老的问题,但无法找到合适的答案,我需要帮助。

我们有第三方项目(让我们称之为#34;记录"了解)以管理所有记录。我的目标是创建一个小窗口表单项目,该项目使用该记录项目的bin中的dll(计数中的13个,其中大多数是依赖的,应用程序不会执行)。由于Record项目不时被更新,我不应该在我项目的bin中保留这些dll的本地副本。我只使用2 dll消耗类(类作为类型),方法和模型,所以我使用ImportDll动态添加剩余的类。

我尝试了以下内容:

1. I added reference to those dll's directly from the record project's
  location (C:\Program Files\Records) but when i build, a local copy is made 
  to my project's bin folder, so i set their copy local property to false. I
  ended up getting an error stating "Assembly must be strong signed in
  order to be marked as a prerequisite.

2. I tried to add the code base 

    <dependentAssembly>
        <assemblyIdentity name="xyz"  culture="neutral" publicKeyToken="null" />
        <codeBase  href="FILE://C:/Program Files/Records/xyz.dll"/>  
    </dependentAssembly>

  I'm getting an exception " Could not load file or assembly 'xyz,  
Version=4.0.0.0, Culture=neutral,     PublicKeyToken=null' or one of
its dependencies. The private assembly was     located outside the
appbase directory. (Exception from HRESULT: 0x80131041)"  I did not
give the version coz, it will get updated frequently.

3. Tried giving the probe path too . but it doesn't work.

4. Added the reference path as per `https://msdn.microsoft.com/en-us/library/6taasyc6(v=vs.100).aspx`.
But my methods and models are not getting identified. 

5. Tried to load as per `https://www.chilkatsoft.com/p/p_502.asp`     
   got an error stating the assemble name was not strong.

我不能使用GAC,因为dll会被第三方更新。

我不确定我是否正确行事。有人可以指导我以正确的方式在运行时(甚至在部署之后)直接从Record项目的bin中引用这两个dll,并在没有本地副本的情况下编译时间并且能够使用这些类和方法? 我希望我已经解释了所有。如果我不清楚请告诉我..

0 个答案:

没有答案