lysergic-acid
lysergic-acid

Reputation: 20050

Default assembly binding behaviour

We are building an API that is stored in an assembly, let's call it MyAssembly.dll

This assembly has an AssemblyVersion of 1.0.0.0

I would expect, that when releasing a new version of the assembly, previous code that compiled referencing to 1.0.0.0 version would break, since the assembly binding would fail (without some extra help like bindRedirect).

In practice, what i see is is the binding actually succeeds.

I have tested it by building a MyAssembly.dll with various different versions, and trying to run various code that was referencing 1.0.0.0

Is this the default behaviour? Does binding to the EXACT version occur only from strong-name (signed) assemblies?

Thanks.

Upvotes: 3

Views: 475

Answers (1)

Daniel Daranas
Daniel Daranas

Reputation: 22624

How the runtime locates assemblies

"By default, the runtime attempts to bind with the exact version of an assembly that the application was built with. This default behavior can be overridden by configuration file settings."

(...)

"Note: There is no version checking for assemblies without strong names, nor does the runtime check in the global assembly cache for assemblies without strong names."

Upvotes: 1

Related Questions