How to fix VS2019 msbuild.exe cannot locate .net framework v4.6 installed on windows 2019 standard OS.

Raju, Ilaiyaraja 0 Reputation points
2023-10-11T15:49:57.8033333+00:00

We are setting new jenkins agent which builds .netframework apps using visual studio 2019 build tools. actually the current server is working fine but its server OS(windows 2012 OS) is moving out of support,hence we are replacing old server with new windows 2019 standard server.

Now we are trying to replicate same visull studio 2019 build tools installation on new windows 2019 server. installation went successful but after installation I'm facing below issues.

  1. Server Manager was not able to start and throwing .net framework 4.0.3019 is missing error. ==> this has been fixed by export working registry key value from old server to new server .I got this fix from microsoft community blog only.
  2. Now I'm not able to open "C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\Current\Bin\MSBuild.exe" ,this msbuild.exe is throwing following error window " MSBuild.exe requires following .net framework version==4.6" .its failing with same error on all the new servers been installed with VS2019 on windows 2019 server.
    The thing is I have all the .net framework packages from 3,3.5,4.6.2,4.7,4.72 and 4.8 installed on the server, but MSBuild.exe is looking for 4.6 version which is also installed on the server but unable to locate it. So seeking your expertise to find out a right fix. Appreciate your help on this issue!
    User's image

Thanks !
Ilaiya R

Windows for business | Windows Server | User experience | Other
Developer technologies | Visual Studio | Other
Developer technologies | ASP.NET | Other
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Tianyu Sun-MSFT 34,436 Reputation points Microsoft External Staff
    2023-10-12T06:32:31.0366667+00:00

    Hello @Raju, Ilaiyaraja,

    Welcome to Microsoft Q&A forum.

    Did you modify some .config files or some settings, maybe by mistake?

    Please right-click MSBuild.exe.config file and click Open With => Choose another app => select Notepad => confirm that the supported runtime version of this line:  <supportedRuntime version="v4.0" sku=".NETFramework, Version=v4.6" /> is set to v4.0.

    Best Regards,

    Tianyu


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


Your answer

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