O.Ghorbani
O.Ghorbani

Reputation: 21

Build ASP Core (ASP 5) Project with Msbuild

I am super new in MSBuild and ASP Core and I have problem in configuring MSBuild with ASP Core (ASP 5).

My last error is:

C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v14.0\DNX\Microsoft.DNX.targets (126): The Dnx Runtime package needs to be installed.

But Dnx is installed.

Main steps that I did with research in web:

  1. Installed latest version of dnvm

  2. Installed latest version of dnx

  3. I had added DNX_FEED enviroment variable to windows user variables with https://www.nuget.org/api/v2 value

  4. I had modified PATH enviroment variable in windows user variables to C:\Users\OAG\.dnx\runtimes\dnx-clr-win-x86.1.0.0-rc1-update1\bin;C:\Program Files (x86)\MSBuild\14.0\Bin;C:\Users\OAG\.dnx\bin

By the way my tfs version is 2013 for msbuild operations.

Upvotes: 1

Views: 678

Answers (3)

O.Ghorbani
O.Ghorbani

Reputation: 21

My problem finally solved

First of all thanks for answers guides me to result

I had used Teamcity instead of TFS Msbuild but the same error that dnx does not installed still exists.

Something that was interesting for me was that I had check it in couple of computers and in some of them all things was working correct and in some another error still exists.

In some cases, I had this error but after adding new Agent to build made error resolved.

After all with this link Specify that MSBuild v14 use CoreClr RC1 for build and adding this line of code to Command Line Parameters:

/verbosity:minimal /p:RuntimeToolingDirectory="C:\Users\Administrator.dnx\runtimes\dnx-clr-win-x86.1.0.0-rc1-update1"

That error disappeared and the error of package can’t be find run dnu restore raised which seems to be easy to resolve, but that was not easy because packages already exists in my dnx folder and in error mentioned that package does not exists (what’s happened?).

By help of Microsoft link Build and Deploy your ASP.NET 5 Application to an Azure Web App that Patrick also mentioned on that I had Added a PowerShell level before main build operation and add Prebuild.ps1 file (exists in link) , that solved dnu restore problem and now Command Line Parameters can be empty in main build operation.

But what is going on?

I found that in build operation (in some cases that I don’t know) Build agent is making separate area for building and use dnx items of its own, in my case build agent works in this folder

C:\Windows\SysWOW64\config\systemprofile\

That contains its own runtimes and packages, and finally I understood what was happened , dnx runtime is not exist error is cause of runtime version doesn’t exists in that area and dnu restore problem is because it’s looking in its own area not user dnx packages.

By the way my target OS is windows server 2008 R2

Upvotes: 1

Eddie Chen - MSFT
Eddie Chen - MSFT

Reputation: 29958

For your issue,

  1. Please the DNX version you installed match the version you used in your project. You can check the installed DNX version by "dnvm list" command and change the version by "dnvm use" command.
  2. When you install or use DNX from DNVM, added -g or -global argument to make sure the DNX can be used by all users.

And when you install dnx from dnvm, DNX bin has been added to user PATH environment variable automatically. So you don't need to add it manually.

Instruction about DNVM: Version Manager

Upvotes: 0

PatrickLu-MSFT
PatrickLu-MSFT

Reputation: 51073

Make sure you have update the global.json to point at the newer runtime.

{
  "projects": [ "src", "test" ],
  "sdk": {
    "version": "1.0.0-rc1-xxxx",
    "runtime": "coreclr"
  }
}

Here is a similar question:https://github.com/aspnet/Tooling/issues/71

Moreover, below article explains what powershell scripts you need to add and how to configure your build. And check the following steps in the link whether to solve the problem. Build and Deploy your ASP.NET 5 Application to an Azure Web App

Upvotes: 0

Related Questions