How does the CLR know that if this assembly is correct?

If we have a .NET executable that uses the .NET library, how does the CLR guarantee that you are using the correct version of the dll? CLRwise, what is considered the β€œcorrect version of the dll,” for starters?

Does he look only at the version? Looks like build time (?). Maybe he is looking at a hash or something else?

thanks

+4
source share
3 answers

You can start learning about the .NET version,

http://msdn.microsoft.com/en-us/library/51ket42z(VS.71).aspx

+3
source

It takes the one used during compilation, is identified by its full name, which includes not only the assembly name, but also full version information and a fingerprint of the digital signature, if any.

+1
source

Other answers already cover its essence.

Basically, the Framework checks the name, version, and signature of the assembly to find a match.
You can set the name and version (and much more!) From the code (AssemblyVersion attributes), and you can easily sign it also with VS.

The signature includes creating a .pfx file (VS will generate it for you) and checking the "icon assembly" in the build settings. This ensures that more than one assembly can coexist with the same name and version.
(So ​​if two companies accidentally created two things with the same name, you can still use them together.)

+1
source

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


All Articles