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.
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>
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);
}
}
}
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);