I\'m having kind of an odd problem with my Team Foundation Service build. I queue it up and it starts just fine, but then it fails with the following error:
Problem Story:
In my case, one of my teammate has used the VisualStudio 2017. There we have downgrade some nuget packages from the project file by writing versions with hands like postsharp etc. It has worked out on there and he pushed the updated code to the gitlab. On my side i have pooled the code from gitlab to my local repo and i have opened it with VisualStudio 2019 and i take this error
Solution:
1- I have opened the code with VisualStudio 2017 from my updated local repo and rebuilt it with it.
2- I have closed the VisualStudio 2017 and reopened with VisualStudio 2019. Rebuild is sucessfull this time
For all who faced
If someone still having this issue on tfs build server you need to go the following:
It seems somehow after upgrading not all projects get those old block of build code removed and it's causing problems (as I understand it it's not longer needed after microsoft changed their bcl build process).
I had to restore packages prior to the clean target of my build script. I mistakenly thought restoring packages prior to building was enough.
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets='GatherBinaries' xmlns='http://schemas.microsoft.com/developer/msbuild/2003'>
<Target Name='RestorePackages'>
<Exec Command='tools\NuGet.exe Restore "Web.sln"'/>
</Target>
<!--
must call RestorePackages prior to clean to avoid error the following error
"The build restored NuGet packages. Build the project again to include these packages in the build."
-->
<Target Name='Clean' DependsOnTargets='RestorePackages'>
<MSBuild Projects='Web.sln' Targets='Clean' Properties='Configuration=Release'/>
</Target>
<Target Name='Build' DependsOnTargets='Clean;RestorePackages'>
<MSBuild Projects='Web.sln' Targets='Build' Properties='Configuration=Release'/>
</Target>
</Project>
The right solution can be found here: https://docs.microsoft.com/ru-ru/nuget/consume-packages/package-restore-troubleshooting
Just add to NuGet.Config:
<!-- Package restore is enabled -->
<configuration>
<packageRestore>
<add key="enabled" value="True" />
<add key="automatic" value="True" />
</packageRestore>
</configuration>