dotnet / msbuild

The Microsoft Build Engine (MSBuild) is the build platform for .NET and Visual Studio.
https://docs.microsoft.com/visualstudio/msbuild/msbuild
MIT License
5.21k stars 1.35k forks source link

System.MissingMethodException: Method not found: 'System.String Microsoft.Build.Evaluation.ProjectCollection.get_DisplayVersion #4382

Open ViktorHofer opened 5 years ago

ViktorHofer commented 5 years ago

Crashed during the native build in corefx. See the attached binlog for more details: binlog.zip

  Failed to generate native component build project!
    Failed to run MSBuild command:

      C:/Program Files (x86)/Microsoft Visual Studio/2019/Preview/MSBuild/Current/Bin/MSBuild.exe

    to get the value of VCTargetsPath:

MSBUILD : error MSB1025: An internal failure occurred while running MSBuild. [C:\git\corefx\src\Native\build-native.proj]
      System.MissingMethodException: Method not found: 'System.String Microsoft.Build.Evaluation.ProjectCollection.get_DisplayVersion()'.
         at Microsoft.Build.CommandLine.MSBuildApp.DisplayCopyrightMessage()
         at Microsoft.Build.CommandLine.MSBuildApp.ProcessCommandLineSwitches(CommandLineSwitches switchesFromAutoResponseFile, CommandLineSwitches switchesNotFromAutoResponseFile, String& projectFile, String[]& targets, String& toolsVersion, Dictionary`2& globalProperties, ILogger[]& loggers, LoggerVerbosity& verbosity, List`1& distributedLoggerRecords, Boolean& needToValidateProject, String& schemaFile, Int32& cpuCount, Boolean& enableNodeReuse, TextWriter& preprocessWriter, Boolean& detailedSummary, ISet`1& warningsAsErrors, ISet`1& warningsAsMessages, Boolean& enableRestore, Boolean& interactive, ProfilerLogger& profilerLogger, Boolean& enableProfiler, Dictionary`2& restoreProperties, Boolean& isolateProjects, Boolean& graphBuild, String[]& inputResultsCaches, String& outputResultsCache, Boolean recursing)
         at Microsoft.Build.CommandLine.MSBuildApp.Execute(String commandLine)

      Unhandled Exception: System.MissingMethodException: Method not found: 'System.String Microsoft.Build.Evaluation.ProjectCollection.get_DisplayVersion()'.
         at Microsoft.Build.CommandLine.MSBuildApp.DisplayCopyrightMessage()
         at Microsoft.Build.CommandLine.MSBuildApp.ProcessCommandLineSwitches(CommandLineSwitches switchesFromAutoResponseFile, CommandLineSwitches switchesNotFromAutoResponseFile, String& projectFile, String[]& targets, String& toolsVersion, Dictionary`2& globalProperties, ILogger[]& loggers, LoggerVerbosity& verbosity, List`1& distributedLoggerRecords, Boolean& needToValidateProject, String& schemaFile, Int32& cpuCount, Boolean& enableNodeReuse, TextWriter& preprocessWriter, Boolean& detailedSummary, ISet`1& warningsAsErrors, ISet`1& warningsAsMessages, Boolean& enableRestore, Boolean& interactive, ProfilerLogger& profilerLogger, Boolean& enableProfiler, Dictionary`2& restoreProperties, Boolean& isolateProjects, Boolean& graphBuild, String[]& inputResultsCaches, String& outputResultsCache, Boolean recursing)
         at Microsoft.Build.CommandLine.MSBuildApp.Execute(String commandLine)
         at Microsoft.Build.CommandLine.MSBuildApp.Main()

    Exit code: -532462766
ViktorHofer commented 5 years ago

cc @danmosemsft

ViktorHofer commented 5 years ago

Happens after upgrading VS 2019 to Version 6.2.0 Preview 1.0 [28915.274.d16.2]

cc @davkean

rainersigwald commented 5 years ago

@ViktorHofer Can you share the output of running https://github.com/microsoft/msbuild/blob/master/scripts/EnumerateMSBuild.ps1? I suspect either you have an MSBuild assembly GACed, or VS Setup allowed mixed MSBuild versions somehow.

ViktorHofer commented 5 years ago

Sure.

C:\git\corefx2>powershell -ExecutionPolicy Unrestricted -File .\EnumerateMSBuild.ps1
Using vswhere from C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe
Found VS Instance: VisualStudioPreview/16.2.0-pre.1.0+28916.205.d16.2
Found VS Instance: VisualStudio/16.0.4+28803.452

Looking for legacy MSBuild versions: C:\Program Files (x86)\MSBuild\

Looking for MSBuild in the GAC: C:\WINDOWS\Microsoft.NET\assembly

Looking for MSBuild in the GAC: C:\WINDOWS\assembly

Output saved to C:\git\corefx2\msbuild_versions.tx

msbuild_versions.txt

rainersigwald commented 5 years ago

Ok, this is a mismatched set (everything should be the 16.2.0 version):

Microsoft.Build.Conversion.Core.dll                   16.2.0-preview.19264.2+c3389964cd55d027344584a70cc8f3f9e0fb348b                                                                                                                                                       C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\MSBuild\Current\Bin\Microsoft.Build.Conversion.Core.dll                                                                       
Microsoft.Build.dll                                   16.1.27-preview+g91af6445a6                                                                                                                                                                                           C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\MSBuild\Current\Bin\Microsoft.Build.dll                                                                                       
Microsoft.Build.Engine.dll                            16.2.0-preview.19264.2+c3389964cd55d027344584a70cc8f3f9e0fb348b                                                                                                                                                       C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\MSBuild\Current\Bin\Microsoft.Build.Engine.dll                                                                                
Microsoft.Build.Framework.dll                         16.1.27-preview+g91af6445a6                                                                                                                                                                                           C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\MSBuild\Current\Bin\Microsoft.Build.Framework.dll                                                                             
Microsoft.Build.Tasks.Core.dll                        16.1.27-preview+g91af6445a6                                                                                                                                                                                           C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\MSBuild\Current\Bin\Microsoft.Build.Tasks.Core.dll                                                                            
Microsoft.Build.Utilities.Core.dll                    16.1.27-preview+g91af6445a6                                                                                                                                                                                           C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\MSBuild\Current\Bin\Microsoft.Build.Utilities.Core.dll                                                                        
MSBuild.exe                                           16.2.0-preview.19264.2+c3389964cd55d027344584a70cc8f3f9e0fb348b                                                                                                                                                       C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\MSBuild\Current\Bin\MSBuild.exe                                                                                               
MSBuildTaskHost.exe                                   16.2.0-preview.19264.2+c3389964cd55d027344584a70cc8f3f9e0fb348b                                                                                                                                                       C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\MSBuild\Current\Bin\MSBuildTaskHost.exe                                                                                       

Can you copy the VS setup logs %TEMP%\dd_*.log into a safe place, and we can chase this down with some Setup folks Monday?

If you need to fix the machine ASAP, you should be able to do so with a repair install of VS, which will reapply the MSBuild package and presumably be consistent then.

ViktorHofer commented 5 years ago

If you need to fix the machine ASAP, you should be able to do so with a repair install of VS, which will reapply the MSBuild package and presumably be consistent then.

I'm meanwhile using the Developer Command Prompt from the stable VS2019 which forces the other msbuild to be used, I'm not blocked.