How to check client / server have the same assembly version?

How to check client / server have the same assembly version?

Old forum URL: forums.lhotka.net/forums/t/7635.aspx


alexsychev posted on Wednesday, September 16, 2009

Hi,
I'm curious what is the best practice to ensure that the client and the server (I'm using CSLA in Client Server mode) both have the same version of shared assembly?

rsbaker0 replied on Wednesday, September 16, 2009

A simple approach is to implement a CommandBase or BusinesssBase class to fetch the assembly version from the server as part of your application start-up. Then you can compare with what is being used client side and throw an exception/display message etc.

ajj3085 replied on Wednesday, September 16, 2009

I think by default if you don't do anything, an exception will be thrown if the versions don't match. Are you finding this not to be true?

rsbaker0 replied on Wednesday, September 16, 2009

ajj3085:
I think by default if you don't do anything, an exception will be thrown if the versions don't match. Are you finding this not to be true?

I have found this definitely to *not* be the case (at least when not using strong names -- I don't know if that matters)

If you make a data_portal call for something that doesn't exist on the server (e.g. it can't be deserialized), then you'll get an exception. But, until you hit a mismatched object server side, all will appear normal.

(I even have the impression that missing fields in two different versions of the same class just end up as null or default value on the "other" side, but I haven't explicitly verified this yet)

ajj3085 replied on Wednesday, September 16, 2009

Ahh... that might be the case. I always srrong name my assemblies, and I know I do get an exception if the versions don't match.

Copyright (c) Marimer LLC