MSDeploy 所有配置 [.config 文件] 在一个包中
目前我们有 4 个不同的环境(Lab、Test、Stage、LIVE),并且我们已经使用 Nant/CC.Net 实现了自动部署。我正在调查和研究使用新的 MSDeploy 工具可以更有效地完成哪些工作。
我想要实现的是创建一个带有配置文件夹的包,其中我们将拥有所有可能环境的所有不同配置文件(基本上添加所有配置转换文件)
我想要实现的是在我们的企业环境中自动部署,其中开发团队无法访问将要部署的服务器。我们只需移交部署包以及预定义的如何安装包的说明。
您能想到的最佳方法是什么?我们不使用 TFS,并且不希望自动构建过程依赖于除 MSDeploy 或易于替换的其他过程之外的任何过程。也考虑使用 MSBuild。
We have 4 different environments at the moment (Lab, Test, Stage, LIVE) and we have implemented automatic deployment using Nant/CC.Net. I am investigating and doing some research as to what can be done more efficiently with new MSDeploy tool.
What I want to achieve is to create a package with a Configuration folder inside which we will have all the different configuration files for all the possible environments (basically adding all config transform files)
What I want to achieve is automatic deployment in our enterprise environment where development team hasn't got any access to the server where it is going to be deployed. We just need to hand over the deployment package with predefined instruction to how to install the package.
What's the best approach you can think of. WE ARE NOT USING TFS and don't want the automatic build process to be dependent on any process as such except MSDeploy or something which is easy to replace. Thinking of using MSBuild too.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您可以使用以下解决方案来实现它。在此期间,我得到了我长期以来读过的最好的书之一的指导。这本书是由 Sayed Ibrahim Hashimi 和 William Bartholomew 撰写的《Microsoft Build Engine 内部》。本书以出色的方式详细介绍了细节。
创建如下所示的 msbuild proj 文件
在添加上述 proj 文件并将环境特定文件添加到文件夹中后,只需通过 msbuild 可访问的命令行运行以下命令
希望这会有所帮助。不要忘记购买/参考“Inside the Microsoft Build Engine”一书。
You can achieve it using below solution. In between, I got the guidance from ONE OF THE BEST BOOK I HAVE READ IN LONG LONG TIME. Book is "Inside the Microsoft Build Engine" written by Sayed Ibrahim Hashimi and William Bartholomew. Book goes through the detail in excellent way.
Create a msbuild proj file as shown below
After adding the above proj file and adding your environment specific files in a folder, simply run the below through msbuild accessible command line
Hope this helps. Don't forget to buy/refer "Inside teh Microsoft Build Engine" book.
一种可能性是自定义安装程序,以便它显示的第一个对话框让用户选择他们要安装的环境。根据该决定,适当的文件将被复制到安装目录并重命名。
One possibility would be to customize the installer so the first dialog it displays lets the user choose the environment they are installing to. Based on that decision, the appropriate file would be copied to the install directory and renamed.
我不能 100% 确定您在寻找什么。
您是否想要一个根配置文件,该文件是从包含所有环境特定设置的“主”文件更新的?您应该看看 XmlPreProcessor http://xmlpreprocess.sourceforge.net/
除了 Pedro 的评论之外,您还可以在所有服务器上放置一个注册表项,说明服务器所属的环境。如果您执行完全脚本化的部署,该包将从该注册表项中获取环境,并为该环境生成正确的配置。节省了人类选择环境的步骤。
I am not 100% sure what you are looking for.
Do you want to have a root config file, that is updated from a "master" file containing all the environment specific settings? You should take a look at XmlPreProcessor http://xmlpreprocess.sourceforge.net/
In addition to Pedro's comment, you could also put a registry key on all your servers, stating what environment, the server belongs to. If you do a fully scripted deployment, the package will pick up the environment from that registry key, and produce the correct configuration for that environment. Saves the human step of choosing environment.