I regularly develop .net applications and use deployment projects to install them on diffe开发者_运维技巧rent servers.
I have 3 different environments:
- Dev
- QA (2 servers)
- Prod (3 servers)
I want to create a custom actions project in which I can do some configuration when installing the application. Some tasks such as:
- make sure debug is set to false
- pick up the necessary config files based on the environment - eg. qa use the qa config etc.
And some more based on the environment.
I want this as automated as possible to speed up deployments. I have looked in to creating custom actions and dont see an issue with this. I have reached a stumbling blocker though:
How does the installer know what server (dev, qa etc) I am installing the application to? Can it look at the server and know based on this or do I input it during setup?
For the tasks directly related to application configuration files and assuming you are using Visual Studio 2010 you may consider using Visual Studio XML transformation which is available out of the box for Web Application Projects and is also made available to applications that depend on App.config files through some workarounds posted online such as:
Visual Studio App.config XML Transformation (Disclaimer: I'm the author of this one)
XDT (web.config) Transforms in non-web projects
I believe using Visual Studio XML transformations is a much cleaner approach than custom actions. However for non configuration tasks you still have the problem stated in your question and I'm afraid I can't be of any help with that.
精彩评论