InvalidProjectFileException error during project file parsing
krisztiankocsis opened this issue · 9 comments
Hi!
I've an issue during the execution of msbuild Build target, which was working with older VS versions before.
Environment:
- Windows 10 Pro 1803
- Visual Studio Community 2017 15.8.1
This is important to us now, so I can provide help, also coding help if necessary!
Error during project file parsing: Microsoft.Build.Exceptions.InvalidProjectFileException: Invalid static method invocation syntax: "[Microsoft.Build.Utilities.ToolLocationHelper]::GetPathToStandardLibraries(a
, b
)). C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets
at Microsoft.Build.Shared.ProjectErrorUtilities.ThrowInvalidProject(String errorSubCategoryResourceName, IElementLocation elementLocation, String resourceName, Object[] args)
at Microsoft.Build.Shared.ProjectErrorUtilities.ThrowInvalidProject[T1,T2](IElementLocation elementLocation, String resourceName, T1 arg0, T2 arg1)
at Microsoft.Build.Evaluation.Expander2.Function
1.Execute(Object objectInstance, IPropertyProvider1 properties, ExpanderOptions options, IElementLocation elementLocation) at Microsoft.Build.Evaluation.Expander
2.PropertyExpander1.ExpandPropertyBody(String propertyBody, Object propertyValue, IPropertyProvider
1 properties, ExpanderOptions options, IElementLocation elementLocation, UsedUninitializedProperties usedUninitializedProperties)
at Microsoft.Build.Evaluation.Expander2.PropertyExpander
1.ExpandPropertiesLeaveTypedAndEscaped(String expression, IPropertyProvider1 properties, ExpanderOptions options, IElementLocation elementLocation, UsedUninitializedProperties usedUninitializedProperties) at Microsoft.Build.Evaluation.Expander
2.PropertyExpander1.ExpandPropertiesLeaveEscaped(String expression, IPropertyProvider
1 properties, ExpanderOptions options, IElementLocation elementLocation, UsedUninitializedProperties usedUninitializedProperties)
at Microsoft.Build.Evaluation.Expander2.ExpandIntoStringLeaveEscaped(String expression, ExpanderOptions options, IElementLocation elementLocation) at Microsoft.Build.Evaluation.Evaluator
4.EvaluatePropertyElement(ProjectPropertyElement propertyElement)
at Microsoft.Build.Evaluation.Evaluator4.EvaluatePropertyGroupElement(ProjectPropertyGroupElement propertyGroupElement) at Microsoft.Build.Evaluation.Evaluator
4.PerformDepthFirstPass(ProjectRootElement currentProjectOrImport)
at Microsoft.Build.Evaluation.Evaluator4.EvaluateImportElement(String directoryOfImportingFile, ProjectImportElement importElement) at Microsoft.Build.Evaluation.Evaluator
4.PerformDepthFirstPass(ProjectRootElement currentProjectOrImport)
at Microsoft.Build.Evaluation.Evaluator4.EvaluateImportElement(String directoryOfImportingFile, ProjectImportElement importElement) at Microsoft.Build.Evaluation.Evaluator
4.PerformDepthFirstPass(ProjectRootElement currentProjectOrImport)
at Microsoft.Build.Evaluation.Evaluator4.EvaluateImportElement(String directoryOfImportingFile, ProjectImportElement importElement) at Microsoft.Build.Evaluation.Evaluator
4.PerformDepthFirstPass(ProjectRootElement currentProjectOrImport)
at Microsoft.Build.Evaluation.Evaluator4.EvaluateImportElement(String directoryOfImportingFile, ProjectImportElement importElement) at Microsoft.Build.Evaluation.Evaluator
4.PerformDepthFirstPass(ProjectRootElement currentProjectOrImport)
at Microsoft.Build.Evaluation.Evaluator4.Evaluate(ILoggingService loggingService, BuildEventContext buildEventContext) at Microsoft.Build.Evaluation.Project.Reevaluate(ILoggingService loggingServiceForEvaluation, ProjectLoadSettings loadSettings) at Microsoft.Build.Evaluation.Project.ReevaluateIfNecessary(ILoggingService loggingServiceForEvaluation, ProjectLoadSettings loadSettings) at Microsoft.Build.Evaluation.Project.Initialize(IDictionary
2 globalProperties, String toolsVersion, String subToolsetVersion, ProjectLoadSettings loadSettings)
at Microsoft.Build.Evaluation.Project..ctor(String projectFile, IDictionary2 globalProperties, String toolsVersion, String subToolsetVersion, ProjectCollection projectCollection, ProjectLoadSettings loadSettings) at Microsoft.Build.Evaluation.ProjectCollection.LoadProject(String fileName, IDictionary
2 globalProperties, String toolsVersion)
at ProjectFileParser.ProjectHelpers.LoadProject(String fullPath, IDictionary`2 args)
at ProjectFileParser.Program.ParseProject(String file, JObject args)
at ProjectFileParser.Program.Parse(String file, JObject args)
at ProjectFileParser.Program.Main(String[] args)
Thanks, it did help, but I had to install all DLLs in MSBuild directory, even if it was not recommended...
I am not sure but I guess there is some misconfiguration in the system previously
Hello @krisztiankocsis could you share more details on how you fixed this issue? I'm facing exactly the same issue.
hi @QianCheng40 did you try the solution in https://developercommunity.visualstudio.com/solutions/311740/view.html ?
Hi @ngyukman thanks for quick reply. I don't have Microsoft.Build.* assemblies in GAC so no need to run those "gacutil \u" commands I assume.
I have both VS2015 and VS2017 installed on my machine. The solution I'm trying to build was created by VS2015 so I also tried:
msbuild {
version = "14.0"
}
but still got the same error (where VS2017 tools still seem to be used)
Hi @QianCheng40
sorry that I was pointing you the incorrect part, it should be https://developercommunity.visualstudio.com/comments/312467/view.html
about installing them in gac
we had similar issue also when having both msbuild installed in workstation and it can be fixed by installing them into gac
Ok, this worth a try although it's not recommended. I don't have admin permission to my work machine required to run 'gacutl /i' right now. Will let you know the result once I get it run. Thank you!
Fixed by installing those assemblies (and System.Collections.Immutable.dll) in GAC now.
gacutil /i "C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\15.0\Bin\Microsoft.Build.Framework.dll"
gacutil /i "C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\15.0\Bin\Microsoft.Build.dll"
gacutil /i "C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\15.0\Bin\Microsoft.Build.Engine.dll"
gacutil /i "C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\15.0\Bin\Microsoft.Build.Conversion.Core.dll"
gacutil /i "C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\15.0\Bin\Microsoft.Build.Tasks.Core.dll"
gacutil /i "C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\15.0\Bin\Microsoft.Build.Utilities.Core.dll"
gacutil /i "C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\15.0\Bin\System.Collections.Immutable.dll"
Ideally, the ProjectFileParser shouldn't have to load those assemblies from GAC.
Thanks & Regards