@vcsjones's comment raises an important point here.
You can drop in a new DLL as a replacement if and only if the assembly version does not change and you are not using strong named assemblies.
If the version does change then you may receive runtime errors because your program tries to load a specific version and gets a different version than it expects. This may however work fine if no method signatures have changed but I wouldn't guarantee it and would always recommend a recompile.
This is even more of a problem when using strong named assemblies since the strong name encodes both the version and a digital signature of the assembly. So if any code has changed in the assembly then the digital signature will change even if the version has not, hence the strong name changes.
Again this will cause runtime errors because the strong name your program expects will not match the assembly strong name. So in this case a recompile is always required.
To summarize:
- Code Change, No Version Change and No Strong Names - OKs
- Version Change and No Strong Names - May require recompile, recommended
- Code Change and Strong Named - Requires recompile
- Version Change and Strong Named - Requires recompile
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…