0

As we know that you need to use dnu to build an ASP.NET 5 project, however TFS 2013 doesn't know how to use dnu.

Is there a process in place to allow TFS 2013 to build ASP.NET 5projects?

Can we for example replace the default command and supply our own in the build definition? if yes how to do it?

nameless
  • 1,483
  • 5
  • 32
  • 78
Sul Aga
  • 6,142
  • 5
  • 25
  • 37

2 Answers2

1

Sul, to overcome the missing Microsoft.DNX.Props was not found issue: You basically need to install Visual Studio Community version on the tfs server. See this link:

https://github.com/aspnet/dnx/issues/2373

After that you can work out the issue with the pre-build script to use DNU.

0

You can include the dnu command in one PowerShell script, then add the PowerShell script in the Pre-build script in the build definition.

So, you need to
1). Create a PowerShell script file to include the due command, named PreBuild.ps1 for example. The PowerShell file is similar to the following (just give you a quick example, you need to do some changes based on your scenario) which is quoted from this link.
Get-ChildItem -Path $PSScriptRoot\src -Filter project.json -Recurse | ForEach-Object { & dnu restore $_.FullName 2>1 }

2). Include the PreBuild.ps1 in the build definition. enter image description here

Vicky - MSFT
  • 4,970
  • 1
  • 14
  • 22
  • thank you for your answer. So after the Pre-Build script run, what will happen? if the default behavior will kick in and runs MS Build against the project then that will fail? do we need to ignore that? Also what about Unit tests? how can you run them as part of the build process? – Sul Aga Oct 15 '15 at 09:37
  • 1). The called script file in the Pre-build script path runs before build starts, and the build will run successfully if all things work correct. 2). To run unit test in the build process, please go to 3.Tests -> Test Source -< specify the unit test project. See: https://msdn.microsoft.com/en-us/library/vstudio/ms253138(v=vs.120).aspx – Vicky - MSFT Oct 15 '15 at 09:50
  • I think I am missing something here. When you say the build will run after pre build script. What command is being used? do I need to care or because my pre build script already restored all the nuget packages then the build will just works regardless of what command it is using. My understanding is that MS Build will not build ASP.NET 5 projects because you need to use dnu. Is this not the case? – Sul Aga Oct 15 '15 at 10:32
  • The pre-build script is called during the TFS build process, it is part of the build definition, you don't need to add any command tool to run it, just follow steps in my reply. You need to install DNX in the script. Check the Prebuild.ps1 in this MSDN article for the details: https://msdn.microsoft.com/en-us/Library/vs/alm/Build/azure/deploy-aspnet5 – Vicky - MSFT Oct 16 '15 at 09:31
  • I am getting this error: The imported project "C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v12.0\DNX\Microsoft.DNX.Props" was not found. Confirm that the path in the declaration is correct, and that the file exists on disk. Do I need to install something on the build server? – Sul Aga Oct 26 '15 at 11:32