Developing c# project with linux server - c#

The school has given us an ubuntu server to use for an svn repository, trac, and building automated processes. The people in my group are all using visual stuido to develop the project.
Right now the server is setup to use ant as the builder and auto reports junit and javadocs to the apache webserver for easy viewing on the web.
My question is, how do I setup the server to do the same thing but for a c# project.
What I have done is install mono on the server. Now I am looking into nant to replace ant on the server but I am struggling to come up with a script to run with the post-commit hook.
From my understanding, we will develop in visual studio and commit through svn and then nant will execute when post-commit hook is called by the svn server.
I also found nunit to replace junit for testing purposes.
Sorry for the random thoughts but basically I am looking for advice/suggestions on how the setup the server for the project. am I headed in the right direction?

Run NAnt through mono or run XBuild (similar to MSBuild). post-commit hooks are ok for very light things, but look at Jenkins or TeamCity or travis-ci.org or AppVeyor or AppHarbor for anything major. Even better, git publish to Azure Web Apps with a free DreamSpark account, and it'll build and deploy on a post-commit hook.

Related

ASP.NET MVC5 CI/CD WIth Jenkins and Github

What I'm trying to accomplish:
Merge code to Github
Jenkins sees the merge and builds the project
Deploy the project to IIS
Navigate to website and see the updated changes.
Sorry if this has already been asked but I have searched all day for a up-to-date tutorial on how to implement continuous integration and delivery with Github, Jenkins, ASP.NET MVC5, and IIS server.
I am pretty new to CI/CD. Could one of you point me to a tutorial that works? I want to learn how to do this so if you have any links to good documentation on the matter, that would be great.
Details:
I am using code first migrations with entity framework 6.
SQL database, Jenkins, and IIS are all on the same server.
Any help would be greatly appreciated
You can install github plugin to jenkins server. Set your server, credentials, project and hook settings(because of need to deploy when commited)
Create your deployment pipeline. You have your project source.
Install msbuild to server and prepare your deployment files.
Now you have deployment files, Use PsExec to stop app pool and web-site. https://gist.github.com/sdesalas/6533286
Use Robocopy to copy your files to server.
Use PsExec to start app pool and web-site.
Thats all. I hope this helps.

Building C# project using jenkins

First of all, im not sure if there is a specific forum thats more suitable for request about Jenkins, but I figured I just post it here.
So, I have this C# project, it right now requires Visual Studio 2015 to build and I would like to automate builds with Jenkins. This is the first time I'm using Jenkins and I was able to set it all up, it fetches the code from the gitlab repository, but right now there is no build action configured. For "fun" i tried to simply make it use a "windows batchfile" as build file and added echo test. Checking the console output it downloads the repository code and then tries to execute the batchfile, result is:
java.io.IOException: Cannot run program "cmd" (in directory "/var/lib/jenkins/workspace/Project"): java.io.IOException: error=2, No such file or directory
This of course makes sense, but I wonder now, is there a way to build a C# project with jenkins on a debian server without resorting to mono or something? I know that people build C++ projects for windows with Jenkins on a linux root, so there has to be some sort of cross compiling possibilities.
If the Visual Studio 2015 is a dealbreaker I can also strap it down to VS13 or even below. Any help is greatly appreciated!
/EDIT
Its probably important to say that Mono is NOT an option. Im using features like WPF that are not available for Mono.
Use Jenkins' MSBuild plugin.
Jenkins.NET is a good blog about using Jenkins in a .NET environment. First post is here.

Develop and Deploy the software which made in C#.Net

I know how to develop C# Winform application, but don't know anything about deployment/distribution for C#. Please say the technologies, procedures, and other setup for my objective.
Objective:
I like to develop and deploy[distribute] one small application software in C# .Net 3.5. I want some capabilities for the distribution that like other software products. ie. I want to develop software with installation wizard, set icon, and run even who didn't have any visual studio[Likewise, how the other software product like java games run without people must not installed the JDK.].
1) If you need an installer you will have to use some install wizard software. Examples are: InstallShield or WISE.
2) Otherwise you do not have to do much, just copy everything from your bin\Release folder to the other computer and run the exe file.
You can use the WiX Toolset to make installers, which also integrate into build processes if you are using a build server. It can be used to make .exe, .msi and various other types of installations, including patches.
As far as I know it's one of the more commonly used installer frameworks, and you can find it here: http://wixtoolset.org/
Deploying Applications, Services, and Components Here you can read about many of the ways you can develop and deploy services from Visual Studio 2013. There are plenty but all are well documented to suit the most different needs.
From the source
Create a setup program: You can create a setup program by using InstallShield Limited Edition, which is free. http://msdn.microsoft.com/en-us/library/dn531020.aspx
Deploy a desktop application: By using ClickOnce deployment, you can publish a desktop application to a web server or a network
file share. Users can then install the application with a single click. http://msdn.microsoft.com/en-us/library/t71a733d.aspx

Deploying application artifacts to web servers

I've been working on deployment automation. Major challenge am facing is copying the files from Jenkins to servers. Artifacts are present in workspace of the deployment job but I am not knowing how to deploy them by taking input parameters as userid and password. Since same job is used by release team and they only have access to production servers. I've searched online but seems there are not many articles for this common scenario. Can anyone suggest how this can be achieved without using tools such as puppet, preferably batch script or power shell script.
I recommend looking at the Jenkins SCP plugin: https://wiki.jenkins-ci.org/display/JENKINS/SCP+plugin
I haven't used it myself, but since you mentioned PowerShell, there is a Jenkins PowerShell plugin: https://wiki.jenkins-ci.org/display/JENKINS/PowerShell+Plugin
The PublishOver plugin looks useful as well: https://wiki.jenkins-ci.org/display/JENKINS/Publish+Over
Alternatively you can run any arbitrary shell command using Jenkins shell script build step.

C#, Deploying windows tasks and services after teamcity build

We have a solution which consists of several projects. Some of the projects are windows tasks, some are windows services and some are mvc-websites which are running on a remote server. On this server we are currently implementing TeamCity as CI server for automating our builds and deployments. As of now, the projects are deployed on this same server. The build, test steps etc works fine but I am not sure how to deploy the tasks and services. All tutorials about this subject (at least those I have seen) only concerns deployment of websites.
The most obvious way is to have a post-build step running a powershell script which are uninstalling the current running windows service, removes the old service, copy the new dll and start the service again. The windows task files could simply be replaced directly with the new version.
However, I do not like this solution, it feels very blunt and could perhaps be hard to implement if the deployment server is remote.
Does anyone have any better suggestion on how to make the deployment?
Have a nice day!
Try to look at Octopus depoy: http://octopusdeploy.com/. You can easy integrate it with TeamCity. It has abillity to star/stop service and much more. Moreover it use nuget packages.
You can deploy windows services via Web Deployment Tool as well. All you have to do is to create manifest.xml file with runCommand (un/install and start/stop service) and dirPath (deploy service) providers.
My manifest file which deploys also DB and web site looks like:
<sitemanifest>
<dbDacFx path='$dbSource' />
<runCommand path='$presync' waitInterval='30000'/>
<dirPath path='$winSource' />
<runCommand path='$postsync' waitInterval='30000'/>
<IisApp path='$webSource' managedRuntimeVersion='v4.0'/>
<setAcl path='$webSource' setAclResourceType='Directory'/>
<setAcl path='$webSource' setAclResourceType='Directory' setAclUser='anonymousAuthenticationUser'/>
</sitemanifest>
It's generated by build script in Psake, but you can do it as you wish.
I wrote two blogs about this topic, but they are in czech language.
Everything in one package
Parametrization of package
Hope, there is something that can help you.
Inedo's BuildMaster can pick up right where TeamCity leaves off using the BuildMaster TeamCity Extension. There's a free version avaiable that will probably solve your requirements.
We have to solve this own problem when we use BuildMaster to build/deploy BuildMaster (before installers get built), and if you take a look at the BuildMaster Specifics (Inedo.com > Support > Specifics > BuildMaster, you can see precicely how we stop/deploy/start the Windows service.

Categories