Without your code running on your system, there isn't anything we can do to help - we have no idea what paths are being assembled here, but ... if you look at the defintion of the Codebase property:
AssemblyName.CodeBase Property (System.Reflection)[
^] it clearly says:
Quote:
Gets or sets the location of the assembly as a URL.
Since File.Delete and File.Copy do not accept URL based paths, you will need a better system.
To be honest, you are storing the DB in totally the wrong place: executing assemblies are normally stored under the app folder (which in production will normally be under "Program Files") or the Windows directory. And both of those will normally require Admin access to modify any files for security reasons. And that oftens means an app fails in production, but works in development.
Have a look here:
Where should I store my data?[
^] - it suggests better places.