How to build an XAF-Application with Visual Studio Team Services
After reading the support question T367724 i decided to write an article about the options you have when building XAF applications with Visual Studio Team Services.
I've done this many times in the past, so i'd like to share my solutions with you.
First of all, you have 3 options to build your solution:
- Using a custom build agent
- Checking in the DevExpress Assemblies into source control
- Using NuGet and my NuGet Package Builder
I will only highlight the 1st and 3rd option, cause i don't like to checkin artifacts into source control (esp. with GIT)
The reason we can't use the hosted build easily, is due the fact, that DevExpress usually installs into GAC. Cause we can't go and install the DevExpress Components on an hosted build agent, we need to use a custom one, or use a different approach to provide the assemblies, so the build can pickup them.
I prefer the NuGet version, so we can maintain different versions of our application, even with different minor versions of the DevExpress components. This approach is good when you have either a large number of applications you need to maintain, or more than one team on different versions.
On a regular machine you can only install 1 minor version of DevExpress, but an unlimited number of major builds.
How to build an XAF-Application with the NuGet approach
I covered how to build your own nuget packages in my last post so i will fast forward here:
- Go and get GIT
- Open a commandline
- Go to a directory you like (I will use
c:\s\gitfor the rest of this post)
- Clone the repository
git clone https://github.com/biohazard999/DXNugetPackageBuilder
- Open the directory
- Install VisualStudio 2015 if you don't have it
- Download and install
.NET Controls & Libraries Installer,
Coded UI Test Extensions for WinFormsand the
.NET Controls and Libraries PDB Filesfrom DevExpress
- Extract the
.NET Controls and Libraries PDB Filesto
c:\tmp\symbolsSo enough preperation so far.
Now we need a private NuGet Feed that is available for the hosted build agent. You can use MyGet, but luckily VSTS now offers a integrated Package Feed for us. This is currently in preview, but works pretty well.
- So head over to the marketplace and install the Package Management extention.
- Head over to VSTS and open the Package hub, add a new Feed (or use an existing one, if you have one)
NuGet 2.x or Visual Studio earlier versions. Copy your feed endpoint.
- Edit the parameters in the
- Adjust the DevExpress Version (in my case 15.2)
- Adjust the
set NugetServer=-NugetSource https://xxx.pkgs.visualstudio.com/DefaultCollection/_packaging/DevExpress/nuget/v2
- Adjust the
set NugetApiKey=-NugetApiKey VSTS(Currently there is no special Api-Key support in preview)
- Adjust the
buildpackages.bat file now should look like this:
set DXVersion=15.2 set SymbolsFolder=c:\tmp\symbols set TargetNugetFolder=C:\tmp\Nuget set Localization=de;es;ja;ru REM set NugetServer= set NugetServer=-NugetSource https://xxx.pkgs.visualstudio.com/DefaultCollection/_packaging/DevExpress/nuget/v2 REM set NugetApiKey= set NugetApiKey=-NugetApiKey VSTS REM set NugetPush= set NugetPush=-NugetPush Powershell.exe -executionpolicy remotesigned -File build.ps1 set Builder=src\DXNugetPackageBuilder\bin\Debug\DXNugetPackageBuilder.exe %Builder% "C:\Program Files (x86)\DevExpress %DXVersion%\DevExpressCodedUIExtensions\Tools" %SymbolsFolder% %TargetNugetFolder% %Localization% %NugetServer% %NugetApiKey% %NugetPush% %Builder% "C:\Program Files (x86)\DevExpress %DXVersion%\Components\Tools\eXpressAppFramework\Model Editor" %SymbolsFolder% %TargetNugetFolder% %Localization% %NugetServer% %NugetApiKey% %NugetPush% %Builder% "C:\Program Files (x86)\DevExpress %DXVersion%\Components\Bin\Framework" %SymbolsFolder% %TargetNugetFolder% %Localization% %NugetServer% %NugetApiKey% %NugetPush%
- If you don't have an Personal Access token yet, create one.
- For VSTS we need to add a source, username and password to authentificate
nuget sources add -Name https://xxx.pkgs.visualstudio.com/DefaultCollection/_packaging/DevExpress/nuget/v2 -Source https://xxx.pkgs.visualstudio.com/DefaultCollection/_packaging/DevExpress/nuget/v2 -Username email@example.com -Password yourPersonalAccessToken nuget setapikey VSTS -Source https://xxx.pkgs.visualstudio.com/DefaultCollection/_packaging/DevExpress/nuget/v2
Thats it for creating and uploading the packages to VSTS and should look like this: