When a query is copied or deployed directly to a new environment the logic around copying the shared object can use improvement.
1. If the file already exists, if we don't know the crc of our new dll (remote crc==0) we assume we need to save under a new name. We should calculate both crcs and compare them instead.
2. If there is a name collision and the files don't match we shouldn't mangle the file name with -1 (actually -#) because that is the same mangling scheme used for the WUID itself.. so the -# version might belong to another workunit already. Maybe we can use another delimiter and still append #.
3. Also need to make sure we are safe multiple processes / threads are trying to write the same file name simultaneously.