I am looking for the most straight forward way to automate the deploy of an MVC 3 application. There is a wealth of information on Stack Overflow already, but much of it seems to be old, and I am not sure what is still relevant to MVC 3.
Here is what I am trying to achieve:
Publish MVC application
Zip files
Copy zip to remote location
It is the “Publish” part of this I am having the most trouble with. Here are my main points of confusion:
How can an automated build be initiated for an MVC 3 app? Do we need to use the AspNetComiler MSBuild Task? I have seen an example of this uses in conjunction with a CSC Task. Are both really needed?
There is a “Build Deployment Package” option in Visual Studio. Can this be initiated with MSBuild? Should this be used instead?
Web Deployment Projects: where do these fit into the picture?
Thanks for any help
I am by far not specialist in application deployment so there might be better ways but here's what I do.
I use Web Deployment Projects to precompile my ASP.NET MVC 3 application
I feed the result of this project to a Setup and Deployment Project
I wrote a custom assembly which is applied to this Setup and Deplyment Project as an Install step and which based on the target IIS version creates App Pool and Virtual Directories.
I ship an MSI to the team responsible for deploying the application. All they need to do is to schedule a task which does an msiexec /u myapp.msi and then msiexec /i myapp.msi.
Remark : in my case all builds are automated in a continuous integration fashion with a Team Foundation Server Build but if you don't have a build server you could also build it manually by running the setup and deployment project which spits an MSI.
Related
We are currently using Team Foundation Server Build Definitions to build our solution and now I want to add deployment to that. We are using TFS Build servers out of the box for our builds. Currently, we are deploying the web app to our dev integration servers using Web Deploy (MSDeploy) from within VS2010 (Publish on the toolbar). The desire is to move this publish to the build server.
What is the best approach to be able to reuse the MSDeploy mechanism (since it's already in place on IIS) and have the build server take over that task? Can I use MSBuild params or do I need an MSBuild project file? How would I configure the appropriate approach in the Build Definition? It is unclear how to configure a Publish using a Build Definition and MSDeploy.
P.S. I've seen several mentions of MSBuild using MSDeploy with cmd line params, but not in the context of using a Team Explorer Build Definition.
Some links to pages that I've seen, but are incomplete based on my needs:
Creating a Build Definition That Supports Deployment
How to Publish Web with msbuild?
The ALM Rangers' Building Guidance has all the information you are looking for, in particular the chapter "Deployment of Applications and Data Stores".
I have ASP.NET MVC web application. I need to deploy it which consists of:
1. Changing some of Web.config sections
2. Building under Release configuration
3. Copying to my deployment server (optional)
What are the ways to automate this process?
1. Changing some of Web.config sections
Use the web.config transformation you can implemnt it by modifing the Web.Debug.config and Web.Release.config in your web project
2. Building under Release configuration
3. Copying to my deployment server (optional)
This post should help. Read also this about the publish thing
We use continuous integration via Jenkins/Hudson to build and a task in it to deploy to staging or production that uses msdeploy in a batch script.
For building, our parameters for msbuild for release builds are:
/Target:Clean;Build /Property:Configuration=Release
It does take a while to figure out the msdeploy options but it is worth looking into (it's what Visual Studio is using behind the scenes to do the deploy if you use the GUI-based approach).
In terms of building under release configuration & copying to your deployment server you can use MS-Build alongside a tool like Team City / Team Build to automate the process.
Here is a great post to get yourself up and running: How to use MSBuild to deploy an ASP.NET MVC application
My team works on a couple of ASP.NET MVC 2 applications, hosted on IIS 7 with an Oracle database. We do our database migrations manually and publish our projects directly to the web servers using Publish to File System in Visual Studio 2010.
Are there any best practices on how to release to test, stage and production environments directly from TFS? We would love to be able to automate our releases completely, including database migration scripts.
The preferred way to perform deployments these days seems to be WebDeploy. I believe this can be integrated into TFS, although we don't use TFS so no experience with this yet. WebDeploy is fully extendable with it's provider model.
You could use WebDeploy as a build task like TheCodeKing says. It works fine, we do it in our project and deploy to a dev-server and a test-server like that. The build definitions are available in the VS Team Explorer and every team member can push a build to Dev or Test.
For the database you could use the Data Dude features (or another schema compare tool) and run it via a TFS Build task (TFS 2010 supports database projects) or via the command line to compare and upgrade the database. This is of course dependent on you using the database projects.
Yes you will use web deploy for details information and step by step guide see the following post
http://mohamedradwan.wordpress.com/2010/10/23/auto-deploy-your-website-for-qa-with-team-build/
Thanks
M.Radwan
Which is the best method to deploy a web application. Currently i am publishing the application and placing that folder in the server and creating virtual directory and providing windows authentication.
I just want to know this is a better metod to deploy or i need to use any other deployment technique?
Plese suggest
It really depends on the situation. For some situations, using Visual Studio's publish feature (right click project) works great. However in some situations, particular larger organizations or environments where the infrastructure group and development team are a little more isolated, you need to use a Web Application Installer or an MSI package. I've also had instances where the easiest thing to do was create a simple .bat file and create an external command in Visual Studio.
Use a web application installer, easy to create with Visual Studio.
If you need a third person to deploy your application in production servers, I would suggest you to deploy using a MSI, it would also help you to version your release.
MSI can be created using various ways including but not limited to
Deployment projects in VS studio
WixGen
Click once
Does anyone know any good solutions for automated deployment to a remote server using SFTP? I am specifically trying to deploy an asp.net mvc website to mosso. I can do it manually every time using an SFTP client, but would much rather have an automated (and consistent) way to do this.
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
deployment tools under .NET solutions
Automatic Deployment Resources