Automatic Deployment Resources

2019-03-16 06:44发布

问题:

I know enough to know that we need to get our application to deploy with a single user action. However, I don't know:

  1. What are some good tools to use in a .NET shop?
  2. How do you manage config changes for each of your environments?

Can someone point me to some good resources for continous integration. I'd like to see some theory as well as a step by step practical guide.

Edit:
I'm in need to automated a web deployment right now; however, I'd also like to learn how to do this for desktop apps.

回答1:

I wrote a blog post that may be helpful:

Visual Studio Web Deployment Projects

It is a year and a half old, but talked about some new (at that time) project templates for VS and also a command-line utility from the IIS team called MSDeploy. They sounded really promising and it appeared they are ideal for targeting multiple build configurations, syncing multiple servers across a farm, and more control all around about the actual output of your website deployment.

Perhaps by now the technologies have matured as well.



回答2:

We've had great success with Windows Installer XML. Basically, you define the components that make up your application in XML and WiX turns that into an MSI package. Documentation is relatively sparse, but the provided CHM file combined with search fu will get you a long way there.

The MSI packages can take input parameters for configuration values and perform actions to manipulate configuration files after the application has been deployed. For example, "msiexec /i MyCustomPackage.msi SqlServer=SomeSQLBox" could deploy the web application and modify the configuration entry for a dependent SQL box.



回答3:

Visual Build Pro from Kinook is a pretty good tool for one-click deployment. It's easy to use and has a lot of capabilities. I have been using it for years. Of course there's also NAnt, which I haven't used much.

As far as managing config changes, I manage multiple config files with extensions that indicate the deployment environment, and then just do a simple rename as a step within my build script.

For example, if I am deploying to Test, I might have a config file called Web.test.config, which gets automatically renamed to Web.config by the build script.



回答4:

I have written a pretty detailed blog post using TeamCity, and Web Deployment projects to automate build and deployment as a starter here:

http://www.diaryofaninja.com/blog/2010/05/09/automated-site-deployments-with-teamcity-deployment-projects-amp-svn

I have then added to this to show FTP addition

http://www.diaryofaninja.com/blog/2010/09/21/continuous-integration-tip-1-ndash-ftp-deployment

A basic process flow is pretty simple:

  • Using a teamcity build server i download from my SVN repo
  • I build and deploy the site to a local folder on the build server
  • I fire a command line FTP client that supports scripting called
  • WinSCP using the MSBUILD Task EXEC (http://winscp.net/)
  • Upload all my sites content
  • Have [insert beverage] of choice

I then make sure that i only deploy the Trunk of my SVN repo, and develop and test everything in an branch before merging - this way only tested stuff gets deployed. Add Automated testing to your build cycle and you've got a match made in heaven.

Some great free tools to get going are:

  • Visual Studio Web Deployment Project
  • TeamCity (free for under 20 build configs)
  • Bamboo


回答5:

I see two different questions:

  • For the deployment thing: The ClickOnce deployment should do it. You just publish your desktop application by going in VS.net at Build menu > Publish. VS.net then compiles a web page and a setup.exe. When users with IE or Firefox and .net 3.5 SP1 click on the link, it runs right away. ClickOnce also handles updating for you and there's extensive API to develop for it.
  • Continuous integration is a very different thing. I suggest that you google for 'CruiseControl.net' and download and try out as many resources as you can. It's basically a build server but you can connect it with SVN, NUnit for testing and so on. I wouldn't suggest buying a book for such a volatile product. It's best to download it and try things out.


回答6:

CruiseControl.NET for your ContinuousIntegration solution. For deployment I use an MSBuild project file. At the top of that I keep all of the servers config files. I pass to MSBuild on the through the parameters a server property which tells MSbuild which config values to use and then completes the deployment. The only deployment that cannot be done right from CruiseControl is the one to our live servers. We leave that command line MSBuild just so we don't accidentally push a button, or so someone with access to the CC.NET web dashboard does it just playing around.