Dotnet frame work error in the VS build task

tarun k 635 Reputation points
2025-08-01T05:00:03.9166667+00:00

I am using VS build task but failing with following error

##[error]C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets(1259,5): Error MSB3644: The reference assemblies for .NETFramework,Version=v4.6.1 were not found. To resolve this, install the Developer Pack (SDK/Targeting Pack) for this framework version or retarget your application. You can download .NET Framework Developer Packs at https://aka.ms/msbuild/developerpacks
##[debug]Processed: ##vso[task.logissue type=Error;sourcepath=C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets;linenumber=1259;columnnumber=5;code=MSB3644;]The reference assemblies for .NETFramework,Version=v4.6.1 were not found. To resolve this, install the Developer Pack (SDK/Targeting Pack) for this framework version or retarget your application. You can download .NET Framework Developer Packs at https://aka.ms/msbuild/developerpacks
Project "C:\azp\agent\_work\3\s\VeracodeDemo.sln" (1) is building "C:\azp\agent\_work\3\s\VeracodeDemo\VeracodeDemo.csproj" (2) on node 1 (default targets).


But the task which is run respective agent alrready configured with below dotent frame work versions

User's image

What is missing? Please suggest fix

Azure DevOps
{count} votes

1 answer

Sort by: Most helpful
  1. Durga Reshma Malthi 11,590 Reputation points Microsoft External Staff Moderator
    2025-08-04T08:16:07.22+00:00

    Hi tarun k

    For Microsoft-hosted agents, this version is not guaranteed to be available. You’ll need a self-hosted Windows agent to ensure compatibility.

    Windows Hosted Agent (windows-latest) no longer has legacy framework targeting packs like 4.5.2. - https://dotnet.microsoft.com/en-us/download/visual-studio-sdks?cid=msbuild-developerpacks

    It has been depreciated.

    Additional References:

    https://stackoverflow.com/questions/71486310/azurepipeline-failing-due-to-the-reference-assemblies-for-netframework-version#:~:text=To%20resolve%20this%2C%20install%20the%20Developer%20Pack%20%28SDK%2FTargeting,can%20download%20.NET%20Framework%20Developer%20Packs%20at%20https%3A%2F%2Faka.ms%2Fmsbuild%2Fdeveloperpacks

    Hope this helps!

    Please Let me know if you have any queries.


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.