traveller
traveller

Reputation: 189

Visual Studio 2008: deploy other files in debug mode than in release mode

I want to deploy other files, not sourcecode but additional files in debug mode than in release mode. In our case, we are working with a file database. In debug mode a development database shall be deployed to a device, in release mode a release database. I know there is a way, to do it utilizing pre- and postbuild events. but is there a way, just to configure both modes differently? The language I use is C#, but does that make any diffeences in this case? It is possible to add all kinds of files to a project, and these files can be copied to the output directory by visual studio. In my case, these files are then copied from output directory (bin\debug, bin\release) to a mobile device. So that works fine. Now for some reason, I just want file A being deployed (copied) when I press F5 in debug mode, and file B being deployed, when in release mode. It would be great, if I could achieve this by configuration. Or in other words, can a project have a link to fileA in debug mode and fileB in release mode.

Upvotes: 0

Views: 281

Answers (1)

Basic
Basic

Reputation: 26756

You haven't specified exactly how this database is deployed - is it an embedded resource? Or just a file in the same directory? Or something that's actually installed/published? It also matters how the project itself is deployed but, some ideas to get you started:

If space and security aren't issues, you could just deploy both and use T4 templating engine on your config file to choose which one is loaded.

Next up is post-build steps as you mentioned. Sometimes it really is just easier (although it can be more complex if different developers have different development environments).

Depending on how you actually do the deployment, the publish/build/package mechanism might do it for you (eg WebDeploy, Setup projects, Install shield, etc).

One last option which is a bit hacky but should work... Put the each version of the database in a new project, then manually edit the project file so that the Debug build references one project while the Release build references the other (Note, that link is for plain Dlls not projects but the technique is the same).

All of the above assumes you're doing something .Net 3.0 or above with a strong weighting for VB or C#. You do need to provide more info, eg for all we know it's a .Net 1.1 Website, IronPython or even C++ which are completely different beasts.

Upvotes: 1

Related Questions