tags:

views:

67

answers:

2

I am posting this query again.Soory, but I dont know how to ask doubts about already asked query.

I am using a COM dll as a reference in my Project. I want that dll to be referenced from any location of computer.

<runtime>    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">        <dependentAssembly>             <assemblyIdentity                 name="MyAssembly"                 culture=""                 publicKeyToken="8968ee41e78ce97a" />             <codeBase                 version="1.0.0.0"                 href="file://c:/some_path/myassembly.dll" />        </dependentAssembly>    </assemblyBinding></runtime>

I have added above mentioned code in App.config file. After signing the Interop.Microsoft.Office.Interop.Excel.dll which was unsigned earlier,I have given proper value for PublicKeytoken.

This I think works fine.

but when i run the application the exe expects the dll to present in same folder & that too

the unsigned version.

Can anyone suggest me, if there is anything which i am missing in my code?

Thanks, Amit

PS: During coding, I had added reference of unsigned version of dll. from C:\Program files...\ [Already existing dll, microsoft provided]

A: 

This is only a guess without reproducing your exact situation... It appears your missing the

 <bindingRedirect oldVersion="1.0.0.0" newVersion="2.0.0.0"/>

In all the examples I've seen as well as all my uses of this, the above <assemblyIdentity...> tag is always followed by a <bindingRedirect ...>. BTW, You can also specify the original version as a range like the following:

 <bindingRedirect oldVersion="0.0.0.0-99.9.9.9" newVersion="2.0.0.0"/>
csharptest.net
A: 

I think i have got the solution. As i mentioned in my question, I had added reference of older[unsigned] version of dll. I removed that & added reference of signed dll,then made changes into App.config[mentioned in my question].

Amit