CodeConverter Version: 10.0.1
OS: Windows
Error
Microsoft.Build.Exceptions.InvalidProjectFileException: No file format header found.
at Microsoft.Build.Construction.SolutionFile.ParseFileHeader()
at Microsoft.Build.Construction.SolutionFile.ParseSolution()
at Microsoft.Build.Construction.SolutionFile.ParseSolutionFile()
at Microsoft.Build.Construction.SolutionFile.Parse(String solutionFile)
at Microsoft.CodeAnalysis.MSBuild.MSBuildProjectLoader.LoadSolutionInfoAsync(...)
at Microsoft.CodeAnalysis.MSBuild.MSBuildWorkspace.OpenSolutionAsync(...)
at ICSharpCode.CodeConverter.CommandLine.MsBuildWorkspaceConverter.SolutionLoader.AnalyzeSolutionAsync(...) in MsBuildWorkspaceConverter.cs:line 87
Description
Despite issue #1195 being listed as fixed in v10.0.1, converting a VB project using a .slnx
solution file still fails with the above error. The bundled
Microsoft.CodeAnalysis.Workspaces.MSBuild.dll is version 4.14.0 (file version
4.1400.25.26210). MSBuildWorkspace in 4.x tries to parse .slnx as a traditional .sln file
and fails at the file header check — .slnx is XML-based and has no such header.
Root Cause
.slnx support in MSBuildWorkspace.OpenSolutionAsync requires
Microsoft.CodeAnalysis.Workspaces.MSBuild 5.x. The latest stable is 5.3.0.
Proposed Fix
Update CodeConv/CodeConv.csproj (and CodeConverter/CodeConverter.csproj):
Microsoft.CodeAnalysis.Workspaces.MSBuild 4.14.0 → 5.3.0
Microsoft.CodeAnalysis.CSharp.Workspaces 4.14.0 → 5.3.0
Microsoft.CodeAnalysis.VisualBasic.Workspaces 4.14.0 → 5.3.0
Microsoft.CodeAnalysis.CSharp.Features 4.14.0 → 5.3.0
References
CodeConverter Version: 10.0.1
OS: Windows
Error
Microsoft.Build.Exceptions.InvalidProjectFileException: No file format header found.
at Microsoft.Build.Construction.SolutionFile.ParseFileHeader()
at Microsoft.Build.Construction.SolutionFile.ParseSolution()
at Microsoft.Build.Construction.SolutionFile.ParseSolutionFile()
at Microsoft.Build.Construction.SolutionFile.Parse(String solutionFile)
at Microsoft.CodeAnalysis.MSBuild.MSBuildProjectLoader.LoadSolutionInfoAsync(...)
at Microsoft.CodeAnalysis.MSBuild.MSBuildWorkspace.OpenSolutionAsync(...)
at ICSharpCode.CodeConverter.CommandLine.MsBuildWorkspaceConverter.SolutionLoader.AnalyzeSolutionAsync(...) in MsBuildWorkspaceConverter.cs:line 87
Description
Despite issue #1195 being listed as fixed in v10.0.1, converting a VB project using a
.slnxsolution file still fails with the above error. The bundled
Microsoft.CodeAnalysis.Workspaces.MSBuild.dllis version 4.14.0 (file version4.1400.25.26210). MSBuildWorkspace in 4.x tries to parse
.slnxas a traditional.slnfileand fails at the file header check —
.slnxis XML-based and has no such header.Root Cause
.slnxsupport inMSBuildWorkspace.OpenSolutionAsyncrequiresMicrosoft.CodeAnalysis.Workspaces.MSBuild5.x. The latest stable is 5.3.0.Proposed Fix
Update
CodeConv/CodeConv.csproj(andCodeConverter/CodeConverter.csproj):Microsoft.CodeAnalysis.Workspaces.MSBuild4.14.0 → 5.3.0Microsoft.CodeAnalysis.CSharp.Workspaces4.14.0 → 5.3.0Microsoft.CodeAnalysis.VisualBasic.Workspaces4.14.0 → 5.3.0Microsoft.CodeAnalysis.CSharp.Features4.14.0 → 5.3.0References