【问题标题】:MSBuild - Solution file error MSB5010: No file format header foundMSBuild - 解决方案文件错误 MSB5010: No file format header found
【发布时间】:2012-10-22 14:53:55
【问题描述】:

我目前正在尝试在虚拟机中构建我的 C# 代码。
该代码在我的本地计算机(Win7、64 位、Visual Studio 2008 Prof)上编译良好。
在我的虚拟机(Win7、64 位、Visual Studio 2008 Prof)上,相同的项目文件无法构建并出现以下错误:

Solution file error MSB5010: No file format header found.

MSBuild(本地机器):

Microsoft (R)-Buildmodul, Version 3.5.30729.5420
[Microsoft .NET Framework, Version 2.0.50727.5456]

MSBuild(虚拟机):

Microsoft (R)-Buildmodul, Version 3.5.30729.5420
[Microsoft .NET Framework, Version 2.0.50727.5456]

项目文件的开头如下所示:

<empty line>
Microsoft Visual Studio Solution File, Format Version 10.00
# Visual Studio 2008
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = [...]

就 MSBuild 的版本输出是否正确而言,我使用的是相同版本的 MSBuild。

但是为什么在一台机器上构建失败,而它在我的本地运行良好?o.O

更新
我删除了导致另一个错误的空行:

Microsoft (R)-Buildmodul, Version 3.5.30729.5420
[Microsoft .NET Framework, Version 2.0.50727.5456]
Copyright (C) Microsoft Corporation 2007. Alle Rechte vorbehalten.

Project.sln(44): Solution file error MSB5008: 
Error parsing the solution configuration section in solution file. 
The entry "" is invalid.

更新
Visual Studio 的语言重要吗?在我的本地机器上,我安装了英文版,而虚拟机上安装了德文版。

【问题讨论】:

  • 尝试删除空行并在VS中重新加载sln
  • @KMoraz 我已经更新了问题。

标签: c# msbuild


【解决方案1】:

确保行尾设置为 Windows 样式 (CRLF) 而不是 Unix 样式 (LF)。如果未正确设置,它们可能会在您从源代码管理中签出时无意中更改。

有关设置 SVN 行尾属性的更多信息,请参阅此question

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2020-09-03
    • 2012-12-15
    • 1970-01-01
    • 2019-05-22
    • 2012-01-29
    • 1970-01-01
    • 2013-07-23
    • 1970-01-01
    相关资源
    最近更新 更多