Forum Discussion
Issues Running the Local Agent
Hi all,
I have installed the local agent on a 2019 Windows Server to experiment with Azure Devops. Besides that I have installed the following components on the machine:
Git
dotnet-sdk-6.0.405-win-x64
I have used the Visual Studio 2022 latest version and the Asp .net Core Web App and published the project to an Azure Repo. The agent is online and I wasnt able to find anything in the Event Log on the Server. However, when I try to run the pipeline which runs based on the following yaml file:
- C:\Windows\ServiceProfiles\NetworkService\AppData\Local\Temp\NuGetScratch\4gjz22ki.hk3.nugetrestore.targets(199,25): error MSB4066: The attribute "Version" in element <PackageReference> is unrecognized. [C:\Windows\ServiceProfiles\NetworkService\AppData\Local\Temp\NuGetScratch\hy554qkz.lbg.nugetinputs.targets]NuGet Version: 6.4.0.123MSBuild auto-detection: using msbuild version '4.0' from 'C:\Windows\Microsoft.NET\Framework64\v4.0.30319'. Use option -MSBuildVersion to force nuget to use a specific version of MSBuild.MSBuild P2P timeout [ms]: 120000C:\Windows\Microsoft.NET\Framework64\v4.0.30319\msbuild.exe "C:\Windows\ServiceProfiles\NetworkService\AppData\Local\Temp\NuGetScratch\hy554qkz.lbg.nugetinputs.targets" /t:GenerateRestoreGraphFile /nologo /nr:false /v:q /p:NuGetRestoreTargets="C:\Windows\ServiceProfiles\NetworkService\AppData\Local\Temp\NuGetScratch\4gjz22ki.hk3.nugetrestore.targets" /p:RestoreUseCustomAfterTargets="True" /p:DisableCheckingDuplicateNuGetItems="True" /p:RestoreTaskAssemblyFile="C:\Agent\_work\_tool\NuGet\6.4.0\x64\nuget.exe" /p:RestoreSolutionDirectory="C:\Agent\_work\1\s\\" /p:RestoreConfigFile="C:\Agent\_work\1\Nuget\tempNuGet_21.config" /p:SolutionDir="C:\Agent\_work\1\s\\" /p:SolutionName="newelements" /p:RestoreBuildInParallel="False" /p:RestoreUseSkipNonexistentTargets="False"NuGet.CommandLine.ExitCodeException: Exception of type 'NuGet.CommandLine.ExitCodeException' was thrown.at NuGet.CommandLine.MsBuildUtility.<GetProjectReferencesAsync>d__6.MoveNext()--- End of stack trace from previous location where exception was thrown ---at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)at NuGet.CommandLine.RestoreCommand.<GetDependencyGraphSpecAsync>d__68.MoveNext()--- End of stack trace from previous location where exception was thrown ---at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)at NuGet.CommandLine.RestoreCommand.<DetermineInputsFromMSBuildAsync>d__63.MoveNext()##[error]The nuget command failed with exit code(1) and error(C:\Windows\ServiceProfiles\NetworkService\AppData\Local\Temp\NuGetScratch\4gjz22ki.hk3.nugetrestore.targets(199,25): error MSB4066: The attribute "Version" in element <PackageReference> is unrecognized. [C:\Windows\ServiceProfiles\NetworkService\AppData\Local\Temp\NuGetScratch\hy554qkz.lbg.nugetinputs.targets])##[error]Packages failed to restoreFinishing: NuGetCommandReally need help here. I have tried different .net versions but that did not went anywhere. So thanks for help
6 Replies
- varunmittalCopper ContributorThis error message suggests that there is an issue with the version of NuGet being used. The error message states "The attribute "Version" in element <PackageReference> is unrecognized" which suggests that the version of NuGet being used does not support the version attribute.
You can try updating the NuGet version to the latest version. You can also try running the pipeline with a specific version of MSBuild by using the option -MSBuildVersion to force NuGet to use that version.
Additionally, make sure that the version of dotnet-sdk that you have installed on your local agent matches the version specified in the pipeline. If the version of the SDK is not compatible with the version of NuGet, it can cause issues like this.
Lastly, it is always good practice to clear the caches and temp folders in the local agent machine. Sometimes, the pipeline may be using an old version of the package, which can cause issues.- orush135Copper Contributor
Hi there,
thank you for the answer. It is now the exact same version of .net and I am still experiencing the issue even after clearing all temp folders etc. In my YAML can you provide me some help what I need to change to force the version of Nuget ?
- sumitjaiswal1Copper Contributor
orush135 i was facing exact same issue, and i was able to solve it by installing standalone version of MSbuild. By default nuget was trying to use msbuild which found in .net framework installation.