After upgrading .net from 3.1 to 6.0 We are getting this error in the pipeline Create ef migrations

Wwiz12/5/2022
dotnet exec step seem to be targetting old frameworks, we have updated EF as well.

2022-12-02T16:31:10.8266249Z Build succeeded.
2022-12-02T16:31:10.8493102Z dotnet exec --depsfile /home/vsts/work/1/s/Api/bin/Debug/netcoreapp3.1/zxy.zxy.zxy.Api.deps.json --additionalprobingpath /home/vsts/.nuget/packages --runtimeconfig /home/vsts/work/1/s/Api/bin/Debug/netcoreapp3.1/zxy.zxy.zxy.Api.runtimeconfig.json /home/vsts/.dotnet/tools/.store/dotnet-ef/6.0.4/dotnet-ef/6.0.4/tools/netcoreapp3.1/any/tools/netcoreapp2.0/any/ef.dll migrations script --context DBContext --output /home/vsts/work/1/a/migrations/DBContext.sql --idempotent --assembly /home/vsts/work/1/s/Api/bin/Debug/netcoreapp3.1/zxy.zxy.zxy.Api.dll --project /home/vsts/work/1/s/Api/zxy.zxy.zxy.Api.csproj --startup-assembly /home/vsts/work/1/s/Api/bin/Debug/netcoreapp3.1/zxy.zxy.zxy.Api.dll --startup-project /home/vsts/work/1/s/Api/zxy.zxy.zxy.Api.csproj --project-dir /home/vsts/work/1/s/Api/ --root-namespace zxy.zxy.zxy.Api --language C# --framework netcoreapp3.1 --working-dir /home/vsts/work/1/s --verbose
Wwiz12/5/2022
My best guess would be that since it seem to be using bin, it is a attempting to use things from a older build to exec a current updated.
Wwiz12/5/2022
Is there a way to clear obj and bin on build server?
Wwiz12/5/2022
But on the build server, it would be spinning up a new container? How is it using bin from a old build
Wwiz12/5/2022
Figured it out, in a build step it was building 3.1. Removed step and script worked.