How to use CruiseControl.NET for database and windows service deployment? - continuous-integration

I have a VS 2008 solutions that includes a number of projects including a couple of class libraries, a web application, a windows service and a SQL 2008 database project. The build server currently has CruiseControl.NET version 1.5.0.6237, command-line subversion client and .NET framework 3.5 SP1 installed (Windows Server 2008 R2, no Visual Studio). I was able to configure ccnet to retrieve get latest from svn repository, build the solution using an MSBuild task and deploy the web application using robocopy. Now I'm struggling to make ccnet deploy the database script and I also need get the windows service deploy and start on the build/dev server. The latest error is that the assembly Microsoft.Data.Schema.Tasks is missing on the build server (I had to add Microsoft.Data.Schema.Common.targets and Microsoft.Data.Schema.SqlTasks.targets files to the solution and modify the database project file to get this far).
What would be the best CI/deployment approach in my scenario? Am I using the right tools for the job, or should I be using something other than ccnet? Do I need to install anything else on the build/dev server to make my life easier?
Please be very specific since I'm new to CruiseControl.NET and MSBuild tasks.

You can use nant.
For a jump start you can use
nantbuilder.
For service install
read this
For a DB deploy read this

Related

How to Deploy a Windows Service using Visual Studio 2017 Community

Working with VS2017 Community I have written a service that works on my local machine. I followed the instruction here:
https://learn.microsoft.com/en-us/dotnet/framework/windows-services/walkthrough-creating-a-windows-service-application-in-the-component-designer
and installed it successfully using Installutil.exe (as per instructions in above link). All good.
I now want to deploy that across six servers in our organisation. In Microsoft's documentation about installing services (https://learn.microsoft.com/en-us/dotnet/framework/windows-services/how-to-install-and-uninstall-services) it says:
If you’re a developer who wants to release a Windows Service that users can install and uninstall you should use InstallShield
and links to a page that applies to VS2012 (can't post any more links as my reputation<10)
I have downloaded and installed the "Microsoft Visual Studio 2017 Installer Projects" package, which allows me to create a Setup Project. When I run it, it installs the project output correctly (i.e. copies the exe & dll files to the correct folder in Program Files) but does not create the service.
There's a detailed post about deploying services on this site (question 9021075) but when I follow those instructions I get a 1001 error on Install.
All the documentation I can find refers to earlier versions of VS or the previous Installer package, so I'm not even certain if I can do it with the software I am using.
So, with VS2017 Community using Microsoft Visual Studio 2017 Installer Projects, how to I create a stand-alone Installer to deploy a service that works correctly when installed locally using InstallUtil?
Or can I use InstallUtil on the target machines? I think I'd need to install Visual Studio on them for that, which I'd prefer not to. Is there a quicker way?
I only have 6 servers to install this on, so even some manual work-around might do.
Thank you for the responses. I now have a solution. I found InstallUtil on the Target Server (in my case it was in C:\Windows\Microsoft.NET\Framework64\v4.0.30319 but search will find it). I copied and added that to my project as content so when I now deploy it, I have InstallUtil in the same folder as my EXE.
To install, I run CMD as admin, cd to project folder and issue command:
installutil.exe myService.exe
This is a one-off task. Once the service is working, to update it I just need to stop it, upload the new myService.exe (& any DLLs) to overwrite the old ones and restart it again.
Further information about settings you're using for the serviceProcessInstaller1 and serviceInstaller1 files will be needed to debug this issue, as the 1001 error raised by the installer is a generic error.
An alternative way of doing this is to use Topshelf, which is a framework for hosting services written using the .NET framework. It simplifies the creation of services, allowing developers to create a simple console application that can be installed as a service using Topshelf. The reason for this is simple: It is far easier to debug a console application than a service. And once the application is tested and ready for production, Topshelf makes it easy to install the application as a service.
Alternatively, you could use InstallUtil.exe. It is part of the .NET Framework, so no need to install Visual Studio.

How to Deploy BizTalk Application into production Server?

I have the following doubts in BizTalk deployment:
How to deploy the BizTalk application to the production server?
When I am modify the existing BizTalk application like artifacts, custom pipeline/functions, custom classes, etc., how again do I deploy the BizTalk application to the server?
I know BTDF is the one of the best tools for deploying BizTalk applications and we can deploy BizTalk application to server using it?
1. Deployment
For deployment you can use the built-in MSI generation wizard.
It means you deploy the application on a dev environment using Visual Studio, then on the admin console, export the application a MSI using the wizard.
Finally you can use that MSI to deploy the app to the Production server.
That's a two step process (Run MSI, import MSI in Bizalk Admin console).
Note that only your Biztalk assemblies are installed by the MSI.
If you use .NET assemblies in your solution, they need to be GAC'ed manually.
You will also need to restart the host instances running your Biztalk application.
See details here:
https://msdn.microsoft.com/en-ca/library/aa559168.aspx
That's a few manual steps.
Alternatively you can automate some of these steps by using the BTSTask, a command line tool included with Biztalk.
You can script all the manual steps.
Obviously it takes time to write such script, so it's only worth it if you are going to deploy many times in non-dev environments.
BTSTask reference:
https://msdn.microsoft.com/en-ca/library/aa559686.aspx
2. Redeployment
Usually you completely remove the old version and then install the new one:
Delete the application from the Biztalk Administration Console and ungac the assemblies it uses.
The whole process would look like:
1. Make sure there are no running instances in you application. You can always disable your receive location and let the running instances complete
2. Delete Biztalk application
3. UnGAC associated assemblies
4. Deploy new Biztalk application version and GAC associated assemblies
5. Restart Host Instances used by your Biztalk application
EDIT: To address OP's concern about deleting a running application:
It is indeed possible to deploy resources independently and never delete your application.
But it does not mean you will not interrupt the service.
An orchestration for example, can never be redeployed when it has running instances.
So assuming that you divided your functionality properly into applications, I find it cleaner and easier to delete the whole application than going after each resource.
Otherwise, yes you can go and replace your resources separately.
But to me it seems like an overhead caused by not having defined applications correctly.
3. BTDF
The Biztalk Deployment Framework is a good tool to have some kind of automation in your deployment without having to write the scripts yourself.
Good compromise between customization to your needs and setup time.
I have used it on a freelance project. It was very helpful because I was able to deliver a package with a only a couple of deployment instructions, and the non-techie client was able to deploy painlessly.

Third party tools in Visual Studio Team Services Continuous Integration

I am planning to move from TeamCity to Visual Studio Team Services CI builds (mainly to avoid having to run and manager a server for TeamCity, version control repository etc.)
My TeamCity build uses a third party obfuscator, called Crypto Obfuscator for obfuscating code when it is built. I have searched through all available documentation online but cannot find out if Team Services lets you somehow install and use third party tools in CI builds.
If not, is there any way obfuscation can be introduced in Team Services CI builds?
Thanks for your time.
The new build system is task-based -- you can either write a custom task and upload it to Team Services, or just call the appropriate command-line utilities on your build server.
If you're using a hosted build server, you'll have no ability to install third-party tools.
The Team Services build service (build server hosted by Microsoft) is not for you. You won't be able to run the obfuscation program you have.
But you can use your own Build server, connect it to Team Services and keep your MSBuild script.

How to Deploy On-Premises with Visual Studio Online Continuous Delivery

My team uses Visual Studio Online ("VSO") to manage our ALM.
We already have a push-button build-process in place to build code from our local Git repo (remotely) and deploy it to a Microsoft Azure Website on Azure.
In addition to this we want a local, development-testing environment built and deployed with a push of a button.
What is the best way to integrate an automated, on-premises development-testing deployment into our development pipeline from within VSO's ALM ecosystem?
[We do also own TFS 2012 -- is there a way to leverage it from VSO to drive an on-premises build deployment from our VSO git repo?]
To deploy builds on-premise, I installed an on-premise build server and used it as the default build controller in my build definition.
When installing the build server select your Visual Studio Online url to point the build server to your team project collection.
I used the instructions here
http://myalmblog.com/2014/04/configuring-on-premises-build-server-for-visual-studio-online/
(normal issues when installing a build server remember to copy over your MSbuild folder from a machine with Visual Studio already installed etc...)
I know it's been a while since the question was asked, but this guy did it with an extension to be added to your VSTS account to deploy directly to an on-premise IIS. I'm going to check this solution today but I'm pretty sure it will work.
https://blogs.msdn.microsoft.com/monub/2016/01/20/visual-studio-team-services-release-management-iis-web-deployment-vnext/
UPDATE
Better yet, MSDN released a complete doc for deploying an asp.net app on IIS
https://www.visualstudio.com/en-us/docs/release/examples/other-servers/net-to-vm

I want to keep my source protected on my development machine, how would I deploy ASP.NET MVC to the server?

I'm not exactly sure what to do, normally I do a commit to SVN and Cruise Control does all this stuff on the server to pull from the repo and deploy everything.
However I am just playing around for fun with my personal VPS and want to know how I can from Visual Studio 2010 (web express) on my local machine just make some kind of installer or DLL or whatever and how to deploy it to my VPS of Windows Server 2008.
Do I upload via FTP and run something or place some files in a certain location and configure through IIS? Or is there some way Visual Studio can just interface with my server and impregnate it with my beautiful code?
From the description given, I'd recommend 2 options:
check whether your server installation currently supports one-click publishing. It's likely an IIS configuration task(s) and/or ensuring your server supports MSDeploy/WebDeploy. See "One-Click Publishing - What's New". Publish Use Visual Studio 2010's Publish command to perform a Web Deploy of your solution.
setup an FTP server on your server. Use Visual Studio 2010's Publish command with the FTP option to push your built solution.
Would this MSDN article help?
The thing is there's capabilities in Visual studio that can publish a web application on a web server.
But you can always do an xcopy deployment as well. And since you've obviously never deployed a web application yet maybe it would be good to learn something and actually deploy it manually.

Resources