0

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.

traveller
  • 189
  • 1
  • 2
  • 10
  • What is wrong with the question? If you cannot answer, why don't you just leave it alone... – traveller Sep 02 '14 at 15:57
  • The downvote isn't me but it's almost certainly because you haven't provided anywhere near enough information for a good answer. You don't mention what language you're using, what version of .Net (if any!), if it's a website, desktop app, mobile app, etc, etc – Basic Sep 02 '14 at 16:59
  • Thank you for your explanation, maybe something is unclear, even if ti seemed to be clear to me. It seemed to me that language does not matter. It is just about pressing F5 in release mode and in debug mode, and files that are copid to the output directory. I added some explanation. – traveller Sep 02 '14 at 17:17

1 Answers1

1

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.

Community
  • 1
  • 1
Basic
  • 26,321
  • 24
  • 115
  • 201
  • Thank you for effort. Sorry. I had hoped, that because I just talk about files in the beginning, it would be clear. I want nothing more than copy a file. If it is a database file (sqlite in my case), or a textfile, or a inifile does not matter. – traveller Sep 02 '14 at 17:36
  • No worries. Did any of the above help? – Basic Sep 02 '14 at 18:17
  • I am not sure, maybe i have to get into these T4 Templates. – traveller Sep 02 '14 at 18:45
  • Incidentally, you've asked 18 questions and never accepted (using the tick on the left). You can also "upvote" with the up arrow. If my answer does help, please accept it. Please also go back through your old questions and accept some answers there. It's a way of acknowledging the time and effort people have spent helping you. Thanks and good luck. – Basic Sep 02 '14 at 23:48
  • hmmm sorry, I tried to upvote your answer, but unfortunately I cannot upvote because I do not have enough reputation. And I only know, if your answer is what I am really looking for, when I learned enough about T4 Templates. But I really really apreciate your effort. – traveller Sep 03 '14 at 07:29