.net - dependAssembly

Today I had a problem with the assembly mismatch, and after a little digging, I found that for a particular DLL, the actual link in the project was made to some other version and
The config file for this project showed a dependency on some other version of the same DLL.

Exp.

<dependentAssembly> <assemblyIdentity name="NHibernate" publicKeyToken="aa95f207798dfdb4" /> <bindingRedirect oldVersion="2.0.1.4000" newVersion="2.1.2.4000" /> </dependentAssembly> 

I removed the dependency declaration for this assembly from the configuration file and voila! I was able to run again :-)

My question is

When are the <dependentAssembly> declarations made in the project configuration file? Do we add them manually? And in what scenario?

+6
source share
1 answer

When are <dependentAssembly> declarations made in the project configuration file? Do we add them manually? And in what scenario?

If you want the software to bind to a newer version of the assembly at run time than to it, which was built against.

Additional information: http://msdn.microsoft.com/en-us/library/7wd6ex19.aspx

Can you also indicate in which scenario we need an older version at compile time and a newer version at runtime?

For example, if you use the vendor API, the vendor may have identified the error and should have released a new version, but you have already submitted it.

+5
source

Source: https://habr.com/ru/post/897838/


All Articles