Command-line to "deploy" ASP.NET MVC project - asp.net-mvc

I am using Visual Studio Team Suites to develop a ASP.NET MVC project. I can deploy the web app to my dev machine using the "deploy" item from IS. Is there a command-line tool to do this task? What I am trying to do is to setup a continuous integration server (using TeamCity Pro), so that whenever I checkin new code, I will get a new build, deploy to a remote IIS server, and then run tests on the testing server.
Thanks,
-Yi

It looks like Microsoft have such a deployment tool. Never used it myself.
Scott Hanselman has blogged about it here

MSDeploy, Microsoft's upcoming command-line deployment tool (which will be integrated into VS2010) is currently available in Beta2.
Info:
http://learn.iis.net/page.aspx/346/web-deployment-tool/
Download (x86):
http://www.iis.net/downloads/default.aspx?tabid=34&g=6&i=1602
Download (x64):
http://www.iis.net/downloads/default.aspx?tabid=34&g=6&i=1603
Also, if you have disk access to the servers you want to deploy to from the CI server and don't need to install/remove things from the GAC or tweak the IIS metabase, plain old robocopy is a great option.

Related

How to automate the download and installation of Sitecore update packages generated from TFS build?

I am developing a Sitecore solution locally using TDS. Our source control and build server is Visual Studio Team Services (in the cloud). I would like to figure out a way to implement Continuous Integration and get builds to be automatically installed on an Integration server that is an Amazon VM (or it could be some other externally located server). I have the TDS build configuration set up to create a Sitecore Update Package. The build process works great. At the end of the build process I have the Sitecore Update Package sitting in a Drops folder in source control (TFS in the cloud). Now I can't figure out how to automate the process of getting that update package out of source control and downloading it to the Integration server and running the Sitecore command to install it.
In a perfect world you would use something along the lines of a fancy Microsoft Release Management to deploy it to the environment of choice. However, if you are like the majority of us mere mortals without the fancy tools - this should help: https://github.com/adoprog/Sitecore-Deployment-Helpers
With these pages you could just send a get request from TFS or use the logic to write a custom PowerShell post-build script. Hope this helps!
As you are using TFS you get to use Release Management for Visual Studio out of the box. This is a simple install but at this time is separate. I have an instance of RM running in a VM and attached to my VSO instance for running deployments.
I would expect this tool, which was bought by MS last year, would become more integrated in vNext.

Customize TFS Auto Builds and Deploys

We use TFS 2012 as our Source Control Repository and we also use it to deploy our Web Applications (primarily ASP .NET MVC applications with Entity Framework Code First Databases) using TFS Build and Deploy from Team Explorer within Visual Studio.
Our's is a fairly small and new setup, so up until now, we developers have been deploying code to the production servers. But from an Audit point of view, it has been decided that code installation will be handed to a separate group. At the moment, before we deploy code using TFS Automated Deploy we do a couple of steps which are manual steps
- Log on the production server, backup the individual application within IIS using IIS --> Export to export it to a zip file.
- Stop application pool for the IIS application where new code is being installed
- Install new code from Visual Studio --> Queue new Build
- Get back on the server to restart the application pool and do tests to see if the application is working as expected.
I wondering, if anyone can guide me, if there is any way to change the Automated Build and Deploy template / process / workflow to do these manual steps before it does these steps before and after it deploys the code? Basically, the new team doing the code install to the Production Server and they will still click and install code automatically but the buid templace / process / workflow will do these steps as a part of the Build / Deploy process.
thanks
if you can code it, Powershell, bat etc. then you can add it to the template.
Identify where in the workflow you need to add your new steps. you can then add an invoke process activity to call out to your scripts, that will do the currently manual steps.
I would have thought most of the IIS steps can be automated using powershell and iis appcmd
Also it may well be worth looking at Release Management 2013 as your deployment pipeline, it will give a more Auditable stream and allow for sign off to approve deployments. http://www.visualstudio.com/en-us/products/release-management-for-microsoft-visual-studio-vs.aspx

Build and deploy asp.net MVC WCF application

I am fairly new to creating deployments for projects.
I have a asp.net MVC web application and WCF service layer (5 services).
Our QA team needs to get latest build packages to test the application.
At the moment we have command line build scripts which gets the latest source, build with the Visual Studio and copy those build outputs to IIS and Services folder(Services are hosted as Windows services).
What would be the recommended way to do this? We have TFS builds, but we are not using those build outputs at the moment.
What would be the recommended way to set up a deployment for these projects?
You should automate your deployment pipeline.
You can use TFS builds in conjunction with Web Deploy or with Octopus to achieve this goal.

TFS 2012 Update 3 Continuous Integration and automatic deployment

I'm hoping someone can help me with putting me in the right direction for setting up automatic deployment from my tfs server to my web server.
I have a build definition set up with the following MSBuild arguments:
/p:AllowUntrustedCertificate=true /p:DeployOnBuild=true /p:PublishProfile=[profileName].pubxml
I get the ERROR_USER_UNAUTHORIZED message. If I add
/p:Password=[passwordHere] for the password of the account in the publishprofile
then it deploys succesfully. Is there a way I can do this so I don't have the password in the build definition?
I saw this post: How do I configure MSBuild to use a saved publishProfile for WebDeploy?
which looks like it can be done, however it's not clear to me how so. If i can somehow use Windows Authentication that would be nice instead of Basic. I have tried adding the /p:AuthType=NTLM but this doesn't seem to do anything. I've tried passing an empty username as some have suggested, but that does not work either. Tried following this as well How do I deploy using MSDeploy and TeamCity with Integrated Windows Authentication?
The destination Web Server is Server 2012 IIS 8 and TFS/Build Server is running Win 2008 SP2 with TFS 2012 Update 3 and both have web deploy v3.5 installed.
You really want to be doing the release independent of the compilation. You will need to promote the same build through your environments. You can do this OOB using the LabTemplate.xaml and configuring environments. That is however not the only way:
Custom build process - hard to maintain and automate
Standard Environments - http://nakedalm.com/standard-environments-for-automated-deployment-and-testing/
Octopus Deploy - Best cheap solution out there
InRelease - OOB in TFS 2013 this tool adds lots of workflow goodness
Check out : http://nakedalm.com/release-management-with-team-foundation-server-2012/

Deploying asp.net MVC application

I've an ASP.NET MVC-2 Website, which is running perfect at my development machine(IIS-7, Win7).
When I copied my full website to remote server(Windows Hosting with .net 4.0), it displays Error-404.
Can you pls assist me to deploy it in remote host machine.
Your question is a bit broad, but for a start might I suggest not manually copying the files over to the new environment (acceptance, production, QA...etc.) as a "deployment mechanism".
Ideally you want to setup a continuous build system which allows you to automatically build your project(s), apply the correct configuration, package and deploy it.
Troy Hunt wrote an excellent 5-part series in which he explains how to create such a setup using TeamCity, Subversion, MSBuild, Web.Config Transformations and Web Deploy.
You can check out the series 'You're deploying it wrong! TeamCity, Subversion & Web Deploy' here:
Part 1: Config transforms
Part 2: MSBuild and deployable packages
Part 3: Publishing with Web Deploy
Part 4: Continuous builds with TeamCity
Part 5: Web Deploy with TeamCity
Of course the same setup is achievable using other software packages (e.g.: Team Foundation Server instead of TeamCity...etc.).
After you've deployed your site using Web Deploy (to a primary server), you can also use the Web Farm Framework to synchronize all of the servers in the farm. You want to avoid manual actions during deployment. Sure you can get all the steps (copying files, adjusting configuration files, synchronizing servers...etc.) correct, but in the long run mistakes are unavoidable.

Resources