microsoft / azure-pipelines-agent

Azure Pipelines Agent 🚀
MIT License
1.72k stars 867 forks source link

[Question]: How to restore missing dependencies ? #4572

Closed g3rzi closed 7 months ago

g3rzi commented 11 months ago

Describe your question

I am able to make changes in the agent and build through the script dev.cmd but when I open the solution with Visual Studio 2017 it shows me that all the dependencies are missing although they are not:
image

It makes debugging harder because I can see some of the object properties. For example, in the RunAsync function in the JobRunner class of Agent.Worker I wanted to see the properties of the Pipelines.AgentJobRequestMessage object which is part of the dependency Microsoft.TeamFoundation.DistributedTask.WebApi.dll but the solution can't find it.

Is there a simple way to restore them? I tried with dotnet restore without success.

Versions

latest, this is a general question, it happens in every solution I tried.

Environment type (Please select at least one enviroment where you face this issue)

Azure DevOps Server type

Azure DevOps Server (Please specify exact version in the textbox below)

Operation system

No response

Version controll system

No response

Azure DevOps Server Version (if applicable)

No response

DmitriiBobreshev commented 11 months ago

Hi @g3rzi, the Microsoft.TeamFoundation.DistributedTask.WebApi.dll is a part of the vss-api-netcore package. You can restore the package by adding https://pkgs.dev.azure.com/mseng/PipelineTools/_packaging/nugetvssprivate/nuget/v3/index.json as a package source in your NuGet setup.

kirill-ivlev commented 10 months ago

HI @g3rzi! Please let us know if you still facing this issue, otherwise we planning to close this issue soon.

g3rzi commented 10 months ago

Thanks,

I edited the NuGet.Config to be like that (based on the URL @DmitriiBobreshev wrote):

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <packageSources>
    <!--To inherit the global NuGet package sources remove the <clear/> line below -->
    <clear />
    <add key="restsdk" value="https://pkgs.dev.azure.com/mseng/PipelineTools/_packaging/nugetvssprivate/nuget/v3/index.json"/>
    <add key="AzureDevOps" value="https://pkgs.dev.azure.com/mseng/PipelineTools/_packaging/nugetvssprivate/nuget/v3/index.json" />
  </packageSources>
</configuration>

But after restart of Visual Studio, it still doesn't show a reference to Pipelines.AgentJobRequestMessage.

The problem is much larger than that, all the dependencies appear to be missing:
image

Did you try to download the repository from scratch?

kirill-ivlev commented 10 months ago

Hi @g3rzi, could you please confirm that you can build agent using.\src\dev.cmd build layout command?

g3rzi commented 10 months ago

Yes, it works. After I run:


PS D:\azure-pipelines-agent-3.225.2\src> .\dev.cmd layout
<REDACTED>
PS D:\azure-pipelines-agent-3.225.2\src> .\dev.cmd build
...
  Build succeeded.
      0 Warning(s)
      0 Error(s)

  Time Elapsed 00:00:00.29
/d/azure-pipelines-agent-3.225.2/src
...
StingyJack commented 8 months ago

@kirill-ivlev - please confirm that VS 2017 is the version of VS that should be used for this.

kirill-ivlev commented 7 months ago

@StingyJack not really, I'm using VS 2022 with no issues. But, before building from MSVS you need to build using dev scripts to restore these dependencies.

Closing this one, since issue is resolved.