Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

2014 - DotNetCologne: Build, Builder, Am Buildesten

847 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.
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
  • Finally found a service provider which actually supplies an essay with an engaging introduction leading to the main body of the exposition Here is the site ⇒⇒⇒WRITE-MY-PAPER.net ⇐⇐⇐
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • Danke für das SlideShare und die interessanten Informationen.
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here

2014 - DotNetCologne: Build, Builder, Am Buildesten

  1. 1. lennybacon.com BUILD BUILD BUILD Daniel Fisher
  2. 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. 3. lennybacon.com EFFICIENT COMMUNICATION…
  4. 4. lennybacon.com © Daniel Fisher Build, Build, Build Daniel Fisher | info@lennybacon.com
  5. 5. lennybacon.com Objectives Serious Software Development Product Delivery C#/.NET AppDomains MsBuild REST APIs AngularJS Code Quality NuGet
  6. 6. lennybacon.com Agenda • What is a Build? • MsBuild • Hosting MsBuild in ASP.NET (YABS?) • MsMetrics, FxCop & Co. • Nunit • …
  7. 7. lennybacon.com WHAT IS A BUILD?
  8. 8. lennybacon.com https://www.flickr.com/photos/86931652@N00/392470198
  9. 9. lennybacon.com
  10. 10. lennybacon.com MSBUILD
  11. 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. 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. 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. 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. 15. lennybacon.com Clone-Repository Update-Version Update-Dependencies Generate-Code Compile-Code Test-Code Analyze-Code Document-Code …
  16. 16. lennybacon.com Custom Tasks public class MyTask : Task { override void Execute() { //TODO: Write your stuff here ... } }
  17. 17. lennybacon.com http://www.flickr.com/photos/64550677@N06/12829392063/
  18. 18. lennybacon.com http://www.flickr.com/photos/toaireisdivine/7245696024/
  19. 19. lennybacon.com https://www.flickr.com/photos/seelensturm/4046487038
  20. 20. lennybacon.com YET ANOTHER BUILD SERVER?
  21. 21. lennybacon.com © Daniel Fisher
  22. 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. 23. lennybacon.com
  24. 24. lennybacon.com © Daniel Fisher
  25. 25. lennybacon.com © Daniel Fisher
  26. 26. lennybacon.com © Daniel Fisher
  27. 27. lennybacon.com
  28. 28. lennybacon.com https://www.flickr.com/photos/hectoralejandro/3967217852
  29. 29. lennybacon.com
  30. 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. 31. lennybacon.com
  32. 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. 33. lennybacon.com https://www.flickr.com/photos/25726169@N03/8600834488
  34. 34. lennybacon.com HOSTING MSBUILD
  35. 35. lennybacon.com References • Microsoft.Build.dll • Microsoft.Build.Engine.dll • Microsoft.Build.Framework.dll
  36. 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. 37. lennybacon.com https://www.flickr.com/photos/jlauletta/14058076975
  38. 38. lennybacon.com APPDOMAIN ISOLATION
  39. 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. 40. lennybacon.com https://www.flickr.com/photos/ryan2point0/4986543660
  41. 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

×