Your SlideShare is downloading. ×
2014 - DotNetCologne: Build, Builder, Am Buildesten
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×

Saving this for later?

Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime - even offline.

Text the download link to your phone

Standard text messaging rates apply

2014 - DotNetCologne: Build, Builder, Am Buildesten

278
views

Published on

Ohne den Build ist Code nichts. Mit Continous Integration und Delivery wird er auch für nicht-Programmierer wichtig. Der Build-Server ist der Herzschlag eines Software-produzierenden Teams. …

Ohne den Build ist Code nichts. Mit Continous Integration und Delivery wird er auch für nicht-Programmierer wichtig. Der Build-Server ist der Herzschlag eines Software-produzierenden Teams.
Aber würdigen wir das auch so? Wer liest den schon Mails von Jenkins? Weg guckt auf das Dashboard von TeamCity? Aus einer Anforderung in einem Projekt hat sich Daniel gefragt, was man anders machen kann und das eine oder andere selbst implementiert. In dieser Session gibt es Ideen, Konzepte, Lösungen und Umsetzung in C# Code und JavaScript mit AngularJS.

Published in: Software

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
278
On Slideshare
0
From Embeds
0
Number of Embeds
6
Actions
Shares
0
Downloads
2
Comments
0
Likes
0
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. lennybacon.com BUILD BUILD BUILD Daniel Fisher
  • 2. lennybacon.com Daniel Fisher • Freelancer – Developer, Architect, Coach, Trainer • Justcommunity.de – Mit-Gründer und Vorstand • nrwconf.de – Mit-Gründer und Organisator • netug-niederrhein.de – Mit-Gründer und Ex-Leiter • microsoft.com – Certified Professional Developer – Business Platform Technology Advisor • lennybacon.com – Blog • twitter.com – @lennybacon
  • 3. lennybacon.com EFFICIENT COMMUNICATION…
  • 4. lennybacon.com © Daniel Fisher Build, Build, Build Daniel Fisher | info@lennybacon.com
  • 5. lennybacon.com Objectives Serious Software Development Product Delivery C#/.NET AppDomains MsBuild REST APIs AngularJS Code Quality NuGet
  • 6. lennybacon.com Agenda • What is a Build? • MsBuild • Hosting MsBuild in ASP.NET (YABS?) • MsMetrics, FxCop & Co. • Nunit • …
  • 7. lennybacon.com WHAT IS A BUILD?
  • 8. lennybacon.com https://www.flickr.com/photos/86931652@N00/392470198
  • 9. lennybacon.com
  • 10. lennybacon.com MSBUILD
  • 11. lennybacon.com News? • MSBuild is now installed as part of Visual Studio rather than as part of the .NET Framework. – The current MSBuild version number is 12.0. If you want to install MSBuild separately, download the installation package from MSBuild Download (http://go.microsoft.com/fwlink/?LinkId=309745).
  • 12. lennybacon.com Properties • Named Value Pairs – Variables of the Build script • Part of a PropertyGroup • Referenced as scalar values – Using the $() syntax <PropertyGroup> <AssemblyName>MyAssemblyName</AssemblyName> </PropertyGroup>
  • 13. lennybacon.com Items • Items are Inputs – Source files, references… • Part of a ItemGroup • Items are referenced as groups – Using the @() syntax <ItemGroup> <CSFile Include="MyLibClass1.cs" /> <CSFile Include="MyLibPropertiesAssemblyInfo.cs" /> <Reference Include="System.dll" /> </ItemGroup>
  • 14. lennybacon.com Targets and Tasks • Tasks are Steps that are performed in a build process as Part of a Target • A build can be told which target(s) to execute <Target Name="Compile"> <MSBuild Projects="MyLibraryMyLibrary.sln" Properties="Configuration=Release" /> </Target>
  • 15. lennybacon.com Clone-Repository Update-Version Update-Dependencies Generate-Code Compile-Code Test-Code Analyze-Code Document-Code …
  • 16. lennybacon.com Custom Tasks public class MyTask : Task { override void Execute() { //TODO: Write your stuff here ... } }
  • 17. lennybacon.com http://www.flickr.com/photos/64550677@N06/12829392063/
  • 18. lennybacon.com http://www.flickr.com/photos/toaireisdivine/7245696024/
  • 19. lennybacon.com https://www.flickr.com/photos/seelensturm/4046487038
  • 20. lennybacon.com YET ANOTHER BUILD SERVER?
  • 21. lennybacon.com © Daniel Fisher
  • 22. lennybacon.com Clone-Repository Update-Version Update-Dependencies Generate-Code Compile-Code Test-Code Analyze-Code Package-Output Sign-Package Deploy-Package Test-DeploymentSign-Output Publish-Package Notify-Stakeholders Document-Code Generate-Manual Report-Results
  • 23. lennybacon.com
  • 24. lennybacon.com © Daniel Fisher
  • 25. lennybacon.com © Daniel Fisher
  • 26. lennybacon.com © Daniel Fisher
  • 27. lennybacon.com
  • 28. lennybacon.com https://www.flickr.com/photos/hectoralejandro/3967217852
  • 29. lennybacon.com
  • 30. lennybacon.com API GET /api/builds POST /api/builds GET /api/builds/{slug} PUT /api/builds/{slug} PATCH /api/builds/{slug} DELETE /api/builds/{slug} BUILD /api/builds/{slug} GET /api/runningBuild/{id}
  • 31. lennybacon.com
  • 32. lennybacon.com Custom Verbs with Web API using System.Net; using System.Net.Http; using System.Web.Http; namespace WebApplication1.Controllers { public class BuildController : ApiController { [Route("api/builds/{id}")] [AcceptVerbsAttribute("GET", "BUILD")] public HttpResponseMessage Build(Guid value) { return new HttpResponseMessage(HttpStatusCode.OK); } } }
  • 33. lennybacon.com https://www.flickr.com/photos/25726169@N03/8600834488
  • 34. lennybacon.com HOSTING MSBUILD
  • 35. lennybacon.com References • Microsoft.Build.dll • Microsoft.Build.Engine.dll • Microsoft.Build.Framework.dll
  • 36. lennybacon.com Programmatically run a build public bool Run(string msBuildFile, Dictionary<string, string> properties) { var envVer = Environment.Version; var toolsVersion = envVer.Major + "." + envVer.MajorRevision; var project = new ProjectInstance(msBuildFile, properties, toolsVersion); var buildRequestData = new BuildRequestData(project, new string[] { }); var buildParameters = new BuildParameters { BuildThreadPriority = ThreadPriority.Highest, DefaultToolsVersion = toolsVersion, UseSynchronousLogging = true }; return BuildManager.DefaultBuildManager.Build( buildParameters, buildRequestData ).OverallResult == BuildResultCode.Success; }
  • 37. lennybacon.com https://www.flickr.com/photos/jlauletta/14058076975
  • 38. lennybacon.com APPDOMAIN ISOLATION
  • 39. lennybacon.com Run in another AppDomain var appDomainSetup = new AppDomainSetup { PrivateBinPath = appPath, ApplicationBase = appPath }; var appDomain = AppDomain.CreateDomain( appName, new Evidence(AppDomain.CurrentDomain.Evidence), appDomainSetup ); var proxyObject = appDomain.CreateInstanceFromAndUnwrap( Assembly.GetExecutingAssembly().Location, typeof (AppDomainManager).FullName ); AppDomain.Unload(appDomain);
  • 40. lennybacon.com https://www.flickr.com/photos/ryan2point0/4986543660
  • 41. lennybacon.com READ LENNYBACON.COM FOLLOW @LENNYBACON LINK LINKEDIN.COM/IN/LENNYBACON XING XING.COM/PROFILE/DANIEL_FISHER FRIEND FB.COM/DANIEL.FISHER.LENNYBACON MAIL DANIEL.FISHER@LENNYBACON.COM CALL +49 (176) 6159 8612