Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

If I rebuild a dll that my project references, do I have to rebuild the project also?

Tags:

c#

reference

dll

I've been writing this program(FOO), and it includes a reference to a dll(BAR). All BAR contains is methods which perform various different calculations. FOO will be able to be installed and deployed on multiple computers. My question is, if I change a formula in one of the methods(i.e. change x + y to x - y), will I need to rebuild FOO against the new BAR? More importantly, is it safe to just deploy the new version of BAR?

like image 607
PiousVenom Avatar asked Dec 06 '12 20:12

PiousVenom


People also ask

How to update project reference in Visual Studio?

Open the project in Visual Studio. Right-click on the project's References folder and select Add Reference to open the Add Reference dialog box. Locate the new assembly version in the Add Reference dialog for each Infragistics assembly listed in your References folder.

What are project references in Visual Studio?

A reference is essentially an entry in a project file that contains the information that Visual Studio needs to locate the component or the service.

How to Add reference in Csproj file?

To add a reference in Visual Studio, right click the "references" folder > choose "add reference" and then "Browse" to you DLL.


1 Answers

@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
like image 167
RobV Avatar answered Sep 23 '22 07:09

RobV