You could get around the code by 'remodeling' a building you want to tear down. We did that - we had a porch that was ready to cave in. We shored it up from the inside then let it set a while, then we took off the outside and put on a new roof... LOL Nobody knows it is a new structure - it's just a remodel....