0

I have a Windows Service which depends on one DLL among others. I have changed a method of one DLL, only its content, not the signature.

For example, old method in DLL is:

public void CalculateTaxes()
{
   // Old content
}

and the new method is:

public void CalculateTaxes()
{
   // New content
}

Note that signature is the same, I am only changing the content.

So my question is: Stopping service, then replacing only the DLL affected and finally starting service is enough to changes take effect or Do I need to replace the entire windows service? In my case only this DLL is affected, the rest of DLLs and Windows service are the same (no changes).

I have found this link but as answer has not been accepted and according to the comment done to this answer, I am not sure if changing only DLL affected is enough.

I am using Visual Studio 2008 and NET Framework 3.5.

Willy
  • 9,848
  • 22
  • 141
  • 284
  • 2
    Why don't you try and find out. – Nikhil Agrawal Jan 23 '18 at 09:42
  • Only DLL replacement is fine. – Vijay Raheja Jan 23 '18 at 09:43
  • I personally had these situations on one of the projects, after we changed .dll we had IIS reset and it worked like a charm ... but can't guarantee it will be same case, you never know what can go wrong – Veljko89 Jan 23 '18 at 09:44
  • Nikhil is right. You could throw together a barebones test and find out for yourself in the time it took to pose the question on SO. – Tomás Jan 23 '18 at 09:44
  • As long as your dll is not strongly signed - it should be fine and you really don't need to recompile your exe with new dll – rahulaga-msft Jan 23 '18 at 10:09
  • No change in the method signature so you don't have to worry about a MissingMethodException. You do have to worry about changing the [AssemblyVersion], the program still looks for the original version and is not going to be happy when a new one unless it is force to with a config file. Not changing the version is not a great idea, at least change the [AssemblyFileVersion]. Micro-managing this is, well, blah. – Hans Passant Jan 23 '18 at 16:00

1 Answers1

0

To my mind the answer depends on how the dll is referenced in the service. If it is referenced to a specific version replacing the dll would resolve in a assemlby not found exception. If the version is not specific it depends only on the name of the assembly and the method, so replacement should work.

See this answer for more informations on "Specific Version".

J.Althaus
  • 36
  • 1
  • 3