0
votes

I have a build step in my TeamCity server with the following configurations.

NOTE: TeamCity is installed in the same machine as my development machine so when I say "TeamCity server I'm referring to my own PC"

Runner Type: Visual Studio (sln)

Step Name: Build Solution

Execute Step: If all previous steps finished successfully

Solution file path: MySolutionFile.sln

Targets: Clean Rebuild

Configuration: Release

When Build Solution step is executed in TeamCity, I get the following error when one of my projects Project.Api.Rest is building:

[Dnx] C:\TeamCity\buildAgent\work\ccd41c6e23422588\Project.Api.Rest\project.json(16, 71): error NU1001: The dependency Microsoft.Extensions.Options.ConfigurationExtensions >= 1.0.0 could not be resolved.

ERROR:

enter image description here

My Project.Api.Rest builds perfectly inside Visual Studio without a problem. Also, out of curiosity, I tried to execute the command that TeamCity is using and it also works perfectly fine, take a look at the screenshot.

COMMAND:

dotnet build "C:\ProjectPath\Project.Api.Rest" --configuration Release --no-dependencies --no-incremental

WORKING COMMAND:

enter image description here

How can I solve this TeamCity error?

TeamCity Version: 9.1.6 (build 37459)

Visual Studio 2015

Windows 10 64-bit

1
I'm facing the same problem here at the company. Do you manage to solve this?Elmer Dantas
@ElmerDantas I somehow managed to to fix this issue but it's not a complete solution. You can delete the .lock.json file for each project that has this errorjmc
I don't think my problem is with lock.json file because I do not have it in my repository. I'm still trying because I have more dependency problem than you had. if I manage to solve, I come back to tell you. ThanksElmer Dantas

1 Answers

0
votes

I managed to resolve something very similar to this by adding a Command Line build step first which ran dotnet restore:

Runner Type: Command Line

Run: Custom Script

Custom Script:

cd "C:\The location of your solution\"

dotnet restore

Then the first thing the build does is install the packages:

[Step 1/2] log : Installing Microsoft.AspNetCore.Mvc.ApiExplorer 1.0.1.

This allowed my solution to build afterwards with no

The dependency xxxx cannot be resolved

errors.