简体   繁体   中英

how to ignore reference version during build process for a project in C#

I have couple of projects that i call them by reflection , some of this project is used external dll ,when i compile my project every thing works fine, the problem happen when i change the external dll to new version (new assembly version) even though the external dll doesn't changed its code, if i recompile my project it will work fine . the thing is how i can build my project and tell them to ignore the assembly version of the reference. this is the exception i got in run time Could not load file or assembly 'TheExternalDLL, Version=9.1.0.61, Culture=neutral, PublicKeyToken=111965d80b18ee08' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT

Your config file may contain a reference to the previous DLL version number, so you may need to update that. If not, you could try adding a binding redirect to your project config file which includes versions up to the new DLL version number. It might look something like this:

<configuration>
  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="TheExternalDLL" publicKeyToken="?" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-9.9.9.9" newVersion="10.0.0.0" />
      </dependentAssembly>
    </assemblyBinding>
  </runtime>
</configuration>

More info: http://msdn.microsoft.com/en-us/library/eftw1fys(v=vs.100).aspx

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM