In part 1, we set up TFS.
In part 2, we configured our Linux build agent.
Now in part 3, we'll be setting up DNX (the .NET Execution Environment) for Linux. Since DNX/ ASP .NET 5 is still in development, we'll be going against the latest dev branch for extra fun.
Exploring the Future Potential of AI-Enabled Smartphone Processors
Building ASP .NET 5 Applications on Linux with TFS 2015, Part 3: Installing DNX
1. In part 1, we set upTFS.
In part 2, we configuredourLinux buildagent.
Nowinpart 3, we'll be settingupDNX(the .NETExecutionEnvironment) forLinux.SinceDNX/ASP.NET
5 isstill indevelopment,we'll be goingagainstthe latestdevbranchfor extrafun.Youcan findmore
detailsonthe ASPNETGitHubpage.
Firstup, we needtoinstall Mono,the open-source CLRandBCL implementation.
Run the followingcommandstogetthat processstarted.
sudoapt-keyadv --keyserverkeyserver.ubuntu.com --recv-keys
3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF
echo"debhttp://download.mono-project.com/repo/debian wheezy main"|sudotee
/etc/apt/sources.list.d/mono-xamarin.list
sudoapt-getupdate
sudoapt-getinstall mono-complete
As always,answeranypromptsthatcome up with"yes",andwaitpatiently.InstallingMonotakesa
while!
Whenit's done,run mono--version
If everythingisokay,you'll see this:
Mono JIT compilerversion4.0.3(Stable 4.0.3.20/d6946b4 Tue Aug4 09:43:57 UTC 2015)
Copyright(C) 2002-2014 Novell, Inc, XamarinIncand Contributors. www.mono-project.com
TLS: __thread
SIGSEGV:altstack
Notifications:epoll
Architecture:amd64
Disabled:none
Misc: softdebug
LLVM: supported, notenabled.
GC: sgen
Nowwe can install DNVM/DNX.
sudoapt-getinstall unzip
curl -sSLhttps://raw.githubusercontent.com/aspnet/Home/dev/dnvminstall.sh |DNX_BRANCH=dev sh
&& source ~/.dnx/dnvm/dnvm.sh
Run those commands,answer"yes"toanyprompts,and whenthey're complete,runthe
dnvmcommandto testthat everythingisinstalled:
___ _ ___ ____ ___
/ _ /|/ / | / / |/ /
/ // / /||/ / /|_/ /
/____/_/|_/ |___/_/ /_/.NET VersionManager- Version1.0.0-beta7-10410
By MicrosoftOpenTechnologies,Inc.
DNVMcan be usedto downloadversionsof the .NETExecutionEnvironmentandmanage whichversion
youare using.
You can control the URL of the stable andunstable channel bysettingthe DNX_FEED and
DNX_UNSTABLE_FEED variables.
Currentfeedsettings:
DefaultStable:https://www.nuget.org/api/v2
DefaultUnstable:https://www.myget.org/F/aspnetvnext/api/v2
CurrentStable Override:
CurrentUnstable Override:
2. Use dnvm[help|-h|-help|--help]todisplayhelptext.
Then,we needtomake sure we have the mostrecentDNX,so run dnvmupgrade -u
You'll see textalongthese lines:
Determininglatestversion
Latestversion is1.0.0-beta7-12340
Downloadingdnx-mono.1.0.0-beta7-12340 fromhttps://www.myget.org/F/aspnetvnext/api/v2
Download:https://www.myget.org/F/aspnetvnext/api/v2/package/dnx-mono/1.0.0-beta7-12340
######################################################################## 100.0%
Installingto/home/ictfs-admin/.dnx/runtimes/dnx-mono.1.0.0-beta7-12340
Adding/home/ictfs-admin/.dnx/runtimes/dnx-mono.1.0.0-beta7-12340/bintoprocess PATH
Settingalias'default'to'dnx-mono.1.0.0-beta7-12340'
Make a note of that path -- you'll needitlater.
We alsoneedtoadd a package source to ourNuGet.Config,somodify~/.config/NuGet/NuGet.Config:
sudonano ~/.config/NuGet/NuGet.Config
Copyand paste thisconfigintothat file andsave it.It's okayif the file isemptyrightnow!
Now,a fewmore prerequisites.We have toinstall Libuvinordertotestthat DNX isworkingproperly,so
run these commands:
sudoapt-getinstall automake libtool curl
Answer"yes"toany prompts.
Thenrun:
curl -sSLhttps://github.com/libuv/libuv/archive/v1.4.2.tar.gz |sudotar zxfv - -C/usr/local/src
cd /usr/local/src/libuv-1.4.2
sudosh autogen.sh
sudo./configure
sudomake
sudomake install
sudorm -rf /usr/local/src/libuv-1.4.2&&cd ~/
sudoldconfig
Finally,we needGitsothatwe can clone the ASPNETrepowiththe sample projectsinit.
sudoapt-getinstall git
Answer"yes"toany prompts.
Nowwe can clone the repowiththe sample code init:
cd ~
git clone https://github.com/aspnet/Home.git
Navigate intothe clonedrepo:
cd Home/samples/latest/HelloWeb
Run the DNU utilitytorestore the missingNuGetpackages.There are some performance issueswith
this,so firstrun
exportMONO_THREADS_PER_CPU=2000
then
dnurestore
If you getan error at thisstep,run
sudoservice unscdstop
, thenrerun
dnurestore
You may alsogetsome errors aboutmissingpackages.Thisisadevelopmentrepo,sostuff isina state
of flux.WhenIwaswritingthisblog,Ihad to openupproject.jsonandaddtwo dependencies:
3. "Microsoft.CodeAnalysis.CSharp":"1.0.0-*",
"System.Reflection.Metadata":"1.0.0-*"
and rerunthe package restore.
Once the restore isdone successfully,we cantestthat everythingisinstalledandworkingproperlyby
running
dnx kestrel
You shouldsee
Application started. PressCtrl+Ctoshutdown.
You should be able toopenup a browserandnavigate to http://yourbuildserver:5004/and see the ASP
.NET welcome page.
Okay,you're done!Your environmentiscorrectlyconfiguredtobuildASP.NET5 applicationsusingDNX!
In our lastblogpost,we'll create a newTFSbuilddefinitionthatwillbuildandpackage upthis
applicationfordeployment!
- See more at: http://www.incyclesoftware.com/2015/08/building-asp-net-5-applications-on-linux-with-
tfs-2015-part-3-installing-dnx/#sthash.6DTnLGaa.dpuf Inpart1, we setup TFS.
In part 2, we configuredourLinux buildagent.
Nowinpart 3, we'll be settingupDNX(the .NETExecutionEnvironment) forLinux.SinceDNX/ASP.NET
5 isstill indevelopment,we'll be goingagainstthe latestdevbranchforextrafun.Youcan findmore
detailsonthe ASPNETGitHubpage.
Firstup, we needtoinstall Mono,the open-source CLRandBCL implementation.
Run the followingcommandstogetthat processstarted.
sudoapt-keyadv --keyserverkeyserver.ubuntu.com --recv-keys
3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF
echo"debhttp://download.mono-project.com/repo/debian wheezy main"|sudotee
/etc/apt/sources.list.d/mono-xamarin.list
sudoapt-getupdate
sudoapt-getinstall mono-complete
As always,answeranypromptsthatcome up with"yes",andwaitpatiently.InstallingMonotakesa
while!
Whenit's done,run mono--version
If everythingisokay,you'll see this:
Mono JIT compilerversion4.0.3(Stable 4.0.3.20/d6946b4 Tue Aug4 09:43:57 UTC 2015)
Copyright(C) 2002-2014 Novell, Inc, XamarinIncand Contributors. www.mono-project.com
TLS: __thread
SIGSEGV:altstack
Notifications:epoll
Architecture:amd64
Disabled:none
Misc: softdebug
LLVM: supported, notenabled.
GC: sgen
Nowwe can install DNVM/DNX.
sudoapt-getinstall unzip
curl -sSLhttps://raw.githubusercontent.com/aspnet/Home/dev/dnvminstall.sh |DNX_BRANCH=dev sh
&& source ~/.dnx/dnvm/dnvm.sh
Run those commands,answer"yes"toanyprompts,and whenthey're complete,runthe
dnvmcommandto testthat everythingisinstalled:
4. ___ _ ___ ____ ___
/ _ /|/ / | / / |/ /
/ // / /||/ / /|_/ /
/____/_/|_/ |___/_/ /_/.NET VersionManager- Version1.0.0-beta7-10410
By MicrosoftOpenTechnologies,Inc.
DNVMcan be usedto downloadversionsof the .NETExecutionEnvironmentandmanage whichversion
youare using.
You can control the URL of the stable andunstable channel bysettingthe DNX_FEED and
DNX_UNSTABLE_FEED variables.
Currentfeedsettings:
DefaultStable:https://www.nuget.org/api/v2
DefaultUnstable:https://www.myget.org/F/aspnetvnext/api/v2
CurrentStable Override:
CurrentUnstable Override:
Use dnvm[help|-h|-help|--help]todisplayhelptext.
Then,we needtomake sure we have the mostrecentDNX,so run dnvmupgrade -u
You'll see textalongthese lines:
Determininglatestversion
Latestversion is1.0.0-beta7-12340
Downloadingdnx-mono.1.0.0-beta7-12340 fromhttps://www.myget.org/F/aspnetvnext/api/v2
Download:https://www.myget.org/F/aspnetvnext/api/v2/package/dnx-mono/1.0.0-beta7-12340
######################################################################## 100.0%
Installingto/home/ictfs-admin/.dnx/runtimes/dnx-mono.1.0.0-beta7-12340
Adding/home/ictfs-admin/.dnx/runtimes/dnx-mono.1.0.0-beta7-12340/bintoprocess PATH
Settingalias'default'to'dnx-mono.1.0.0-beta7-12340'
Make a note of that path -- you'll needitlater.
We alsoneedtoadd a package source to ourNuGet.Config,somodify~/.config/NuGet/NuGet.Config:
sudonano ~/.config/NuGet/NuGet.Config
Copyand paste thisconfigintothat file andsave it.It's okayif the file isemptyrightnow!
Now,a fewmore prerequisites.We have toinstall Libuvinordertotestthat DNX isworkingproperly,so
run these commands:
sudoapt-getinstall automake libtool curl
Answer"yes"toany prompts.
Thenrun:
curl -sSLhttps://github.com/libuv/libuv/archive/v1.4.2.tar.gz |sudotar zxfv - -C/usr/local/src
cd /usr/local/src/libuv-1.4.2
sudosh autogen.sh
sudo./configure
sudomake
sudomake install
sudorm -rf /usr/local/src/libuv-1.4.2&&cd ~/
sudoldconfig
Finally,we needGitsothatwe can clone the ASPNETrepowiththe sample projectsinit.
sudoapt-getinstall git
Answer"yes"toany prompts.
Nowwe can clone the repowiththe sample code init:
cd ~
5. git clone https://github.com/aspnet/Home.git
Navigate intothe clonedrepo:
cd Home/samples/latest/HelloWeb
Run the DNU utilitytorestore the missingNuGetpackages.There are some performance issueswith
this,so firstrun
exportMONO_THREADS_PER_CPU=2000
then
dnurestore
If you getan error at thisstep,run
sudoservice unscdstop
, thenrerun
dnurestore
You may alsogetsome errors aboutmissingpackages.Thisisadevelopmentrepo,sostuff isina state
of flux.WhenIwaswritingthisblog,Ihad to openupproject.jsonandaddtwo dependencies:
"Microsoft.CodeAnalysis.CSharp":"1.0.0-*",
"System.Reflection.Metadata":"1.0.0-*"
and rerunthe package restore.
Once the restore isdone successfully,we cantestthat everythingisinstalledandworkingproperlyby
running
dnx kestrel
You shouldsee
Application started. PressCtrl+Ctoshutdown.
You shouldbe able toopenup a browserandnavigate to http://yourbuildserver:5004/and see the ASP
.NET welcome page.
Okay,you're done!Your environmentis correctlyconfiguredtobuildASP.NET5 applicationsusingDNX!
In our lastblogpost,we'll create a newTFSbuilddefinitionthatwillbuildandpackage upthis
applicationfordeployment!