none
Visual studio: Error Invalid static method invocation syntax RRS feed

  • Question

  • error : Invalid static method invocation syntax: "[MSBuild]::IsRunningFromVisualStudio()". Method '[MSBuild]::IsRunningFromVisualStudio' not found. Static method invocation should be of the form: $([FullTypeName]::Method()), e.g. $([System.IO.Path]::Combine(ab)). C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets

    Can not create any new python application or open existing application?

    Please help me out

    thanks

    Mahesh S

    Monday, March 18, 2019 2:24 PM

All replies

  • Hi Mahesh S,

    Welcome to MSDN forum.

    Firstly, please reboot and start visual studio installer to repair visual studio professional 2017(update visual studio to the latest version if it is needed) to check if you have corrupted package in the installation. after this, open visual studio and see if the issue persists.

    In addition to this, see if you have msbuild assemblies in the GAC for some reason. In which case I would recommend removing them from the GAC entirely.

    Please let us know if it works for you!

    Best regards,

    Joyce


    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Tuesday, March 19, 2019 2:46 AM
  • i opened developer command prompt for VS2017 and try to run gacutil -u msbuild  and gacutil -ul msbuild it says  failed to open assemblies list file msbuild. I am also trying to repair my VS professsional 2017. once it shows any sign of progression i will let you know, Thanks Joyce for answering my Question
    Wednesday, March 20, 2019 9:27 PM
  • i rebooted the VS2017 and also updated to latest version of 15.9.9, and when i try to use developer command prompt for VS2017 as Admin and ran gacutil -u msbuild it shows that Unable to uninstall: assembly is required by one or more applications, 

    can you help me what is the other option?

    Thanks,

    Mahesh Sompalli

    Thursday, March 21, 2019 6:08 PM
  • Hi Mahesh S,

    Welcome to MSDN forum.

    Firstly, please reboot and start visual studio installer to repair visual studio professional 2017(update visual studio to the latest version if it is needed) to check if you have corrupted package in the installation. after this, open visual studio and see if the issue persists.

    In addition to this, see if you have msbuild assemblies in the GAC for some reason. In which case I would recommend removing them from the GAC entirely.

    Please let us know if it works for you!

    Best regards,

    Joyce



    Did you add any msbuild assemblies in GAC by yourself? If not, you don't need to run gacutil -u msbuild.

    Can you able to create a new python project after repairing visual studio 2017 in visual studio installer? The others who has the similar issue with you solved it by repairing it.

    in addition to this, please have a look at the similar thread:

    https://stackoverflow.com/questions/47670576/invalid-static-method-invocation-syntax-msbuildisrunningfromvisualstudio

    Best regards,

    Joyce


    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Friday, March 22, 2019 9:03 AM