Question

I have inherited a project that has one solution with a number of projects:

  • Utility A - console application
  • Utiltiy B - console application
  • Commons C - shared by other projects
  • Web App D - provides administrative and support functions

Now, D references some code in A and B, meaning that A.exe and B.exe are copied to the bin folder of D. However, other processes occasionally need to directly invoke A.exe and B.exe. They can't be called directly from D\bin, because that folder just contains the .exe, not the app.config files.

The previous workaround was deploying A, B, and D to different destinations, with A.exe.config and B.exe.config deployed only within their own folders. I'd like to get away from having 3 different deployments when it could be just one, but I'm not sure how to do it. I have tried fiddling with various 'build actions' and 'copy to output' options, but nothing seems to work.

How can I make Visual Studio copy the A\app.config to D\A.exe.config? Ideally, without a post-build script.

Was it helpful?

Solution

For custom deployments I've always has to rely on post-build scripts to do it right (and, unfortunately, they're not as good as they are in C++).

Another thing I have done is to set up the projects so that the build output is in the same location for all projects (Respecting Debug & Release, of course), and then add the config files to their respective solutions and change the "Copy To Output" property of the config files to "Copy if Newer". This would ensure everything ended up in the same place, with the dependencies, and you wouldn't need a post-build script.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top