Building C# project using jenkins - c#

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.

Related

monodevelop - working debug but not working release

I have developed a project with VS on Windows 10. Right now on Linux mint i am debugging the project with MonoDevelop and it runs just fine.
Let me show you:
However when i make a build and i go to the Release folder and then i try from the terminal to launch the program i have a problem. Let me show you first the files i have build:
Then i go to the directory with my terminal and i run:
chmod +x ./WorldServer.exe then i run ./WorldServer.exe
and i receive the following error:
I know that this is .exe file and maybe i have to build a different type of file. But i am not really sure what setting should i apply in my project to make a working build for linux.
As far as i know linux is using .so as extension for it's libraries. However it is generating .dll files. Can i change that? Can i somehow make my project to be "buildable" in the two OS Linux and Windows ?
The exception tells us, you need System.Management in your project. It isn't there.
Why?
Because Mono, according to there Road-map, doesn't support this:
The following do not map to operating systems other than Windows, and
we are unlikely to spend time to support them even on Windows:
System.Management
How?
System.Management is a library that only works on Windows. The MySQL connector driver has started to depend on this library and tries to load it per reflection.
I'm not into this whole MySql Progess but there is an open bug for it. Also there is a comment which says:
The last working version of the MySQL .NET Driver is 6.4.6
I hope this helps you.

.Net project static code analysis through Jenkins and SonarQube

What I Need -
Dears - I am in process of creating a Jenkins Job for my .Net Solution. The solution has an ASP.NET web application project and a Winforms Project along with several other class libraries,
As a part of the Jenkins job execution, I would also want to perform Static code analysis for which I would be executing SonarQube runner as 'Pre' and 'Post' Build steps.
What have I done so far -
It is to be noted that, I have already installed all of the tools (Jenkins, SonarQube services) and all of the needed plugins (MSBuild, C#, Javascript, Powershell, SonarQube runner etc.,)
I could see that my job executes successfully. Build is good and SonarQube scanner also ran without any issues.
The problem -
Post successful build and analysis, I am seeing analysis report only for ASP.NET web application project in my SonarQube Dashboard. But I am interested only in the Winforms project.
My build is done through MSBuild.exe and I am pointing to the Solution file. Please note that the Winforms project is my Startup project. But nevertheless I could see that SonarQube runner is picking only ASP.NET project for analysis.
My Question -
If someone could tell me how to get the results of the Winforms project it would be great. Let me know, if I am lacking any bit of information. I can provide them.
Thanks in advance - Happy Coding !!!
EDIT - I don't have any projects in the exclusion list. Just the default test projects.
Attaching my MSBuild default exclusion list.

How to deploy a compiled application without Visual Studio?

When I open a sample Blinky application in Visual Studio, compile and run it, it gets automatically deployed to the target configured WindowsIoT device. After that, on Windows 10 machine where I compile it, the application binaries are located in the bin sub-folder of the project folder as one would expect.
I would like to automate the deployment, so that I could run deployment code
without Visual Studio, specify target device and the binaries location and it would deploy it. I cannot find any API that allows
to deploy apps to Windows IoT, how do I do that?
This shiny Windows IoT stuff is a new area, and there is not a lot of info available apart from the samples and the getting started page. Any pointers are appreciated.
Update: As noted in comments, once one start thinking of mass production, they will probably need to conciser ICD. This, is not, however the problem I'm trying to solve currently. I would like to figure out how I can provide Over-the-Air updates to my UWP application running on Raspberry Pi and Windows IoT. I also would you like to know how I can automate build / deployment in general, but that may be automatically solved if I have a proper OTA solution.
There is a set of instructions on how to do it, which can be found in the same github repo you are linking in your question, but in a different folder. Note, that you need an appx for these instructions to work, and it's not created by the solution build by default.
This page provide (non IoT specific) instructions on using VS to build the appx. And this blog post talks about the command line tool that can be used for making appx.
Note, that the last two links are also talking about publishing an application to app store, so you'll need to make some mental adjustments around that.

Developing c# project with linux server

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.

How do I set up an ASP.NET build server?

I want to create an ASP.NET build server for the first time since I've never used it.
Does anyone have a tutorial or resource on how to make an ASP.NET build server?
Or can anyone tell me how it's done?
If by "create" you mean "setup a build server" then I suggest you take a look at TeamCity from JetBrains.
TeamCity is a multi purpose build server and can be used to build ASP.NET projects as well. You can get up and running for free, and its very easy to set up, compared to CruiseControl.Net.
Take a look at MSBuild to see how to do specific ASP.NET build stuff.
MSBuild reference
How to use MSBuild to do ASP.NET compilation (video)
You might need something from the msbuildtasks open source task collection
If you really want to create your own build server from scratch (but why?), I can't help you.
You could make a build server using CruiseControl.NET which can build your project.
CruiseControl.Net Tutorial – Part 1
CruiseControl.Net Tutorial – Part 2
There is no ASP.NET build server as such.
Do you have a one-click build script? If not, you should create that first. Once you are able to run a single command and get a complete build, then it is easy to set up CruiseControl or some other build server.
Given the strength of the build servers out there it's really not sensible to spend any time developing your own.
You will, however, need at the minimum
a one-click build script
a source code repository (e.g. Subversion, TFS, or even [shudder] SourceSafe)
a server to use as a build box (I use a virtual image)
You may also find a one-click deployment script written using something like Powershell to be useful, too.
Note that a very effective alternative to CruiseControl.NET and TeamCity is Hudson. Although it's written in Java it's ridiculously simple to get going with a J2EE server like Tomcat.
The key strength of Hudson is the range the plug-ins, which allow you to monitor most version control systems and then not just build (through MSBuild or even the command line) but also run unit tests, acceptance tests, and so on.
You might look at Web Deployment Projects -- they allow you to build your site and merge all DLLs into a single file, for a fully pre-compiled site. You can use it with MSBuild.
An option on the automation side is Team Foundation Server's (TFS) automated builds. TFS also includes source control, bug tracking and many other features you may or may not need.

Categories