My web.config file provides the
database connection strings that may
differ between the systems. What is
recommended method to defer this such
that it is specific to the dev
environment?
For App|Web.config here's what we do:
- Add web.config to svn:ignore
- Copy web.config to web.default.config
- Add web.default.config to svn
- Add the following to your BeforeBuild target
<Target Name="BeforeBuild">
<CallTarget Targets="SetupWebConfig" />
</Target>
<Target Name="SetupWebConfig" Condition="!Exists('Web.config')">
<Copy SourceFiles="Web.default.config" DestinationFiles="Web.config" />
</Target>
FWIW, we also have another target which gets called before SetupWebConfig which deletes web.config if the build server is compiling the project, this allows changes to web.default.config to be included.
You can get fancy and automatically replace content in Web.config using a token inside Web.default.config and some regex. This can also be bundled into the SetupWebConfig target. Let me know if you want to see an example. We do this for setting connection strings and similar stuff on our CI/build servers.
My test project is dependent on NUnit,
Moq, among other libraries. If the
location of these libraries differs
across the dev systems does this break
the references? If so, how can I
mitigate this issue?
My advice would be to include the libraries in your subversion/git repository, place them in a common area, not your project, that way you can reuse them. Reference them using relative svn:externals (remember to set the externals to a specific revision number). This solves your problem plus allows you fine-grained control over what version of each tool you want to use, which is good for testing and maintenance of released products on branches.