Share via


Visual studio: Error Invalid static method invocation syntax

Question

Monday, March 18, 2019 2:24 PM

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

All replies (4)

Tuesday, March 19, 2019 2:46 AM

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 [email protected].


Wednesday, March 20, 2019 9:27 PM

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


Thursday, March 21, 2019 6:08 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


Friday, March 22, 2019 9:03 AM

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 [email protected].