BOM导致的Build failed in Jenkins with error MSB4025

昨天有个release持续build fail,报错为

error MSB4025: The project file could not be loaded. Data at the root level is invalid. Line 1, position 1.

用Notepad++临时打开查看,没有发现任何异常

在Stash上能发现文件开始处多了一些小红点

这个 "\ufeff" 就是BOM (byte order marks) [wiki]

既然代码里有这个,删除即可,jenkins build success

查看了Master上的代码,没有这个问题,所以平时也不会有问题。

在这个Release Branch上查看History, 发现红点出自去年的某次提交,然后在这个branch中便一直保留下来了。

正好昨天merge一些code ,所以带出来这个问题。

因为BOM是Windows的默认模式,所以在跨平台工作的时候,很容易出现这个问题,肉眼很难分辨出来。

在Unix下用VI做个实验:

With BOM

Without BOM

结果立现!

结论 : Windows下默认编辑器的UTF-8是with BOM的,而UTF-16因为涉及到Big-Endian/Little-Endian,也会添加BOM的标识在字节流的开头。所以建议所有源文件使用UTF-8 without BOM的 格式存储。

时间: 2024-08-06 12:13:45

BOM导致的Build failed in Jenkins with error MSB4025的相关文章

Page build failed: Missing submodule的解决方案

最近想整理一下工作室官网的东西,那是一个用github pages写的网站,在上传一些post文章的时候,突然给我发邮件说有错误: The page build failed with the following error: The submodule `52FeidianStudio.github.io` was not properly initialized with a `.gitmodules` file. For more information, see https://help

【Vue报错】Module build failed: Error: No parser and no file path given, couldn't infer a p arser.

在创建一个vue项目启动时报错,报错的内容为: error in ./src/App.vue Module build failed: Error: No parser and no file path given, couldn't infer a p arser. at UndefinedParserError.Wrapper (D:\dyyc\bookstore\[email protected] [email protected]\index.js:1948:14) at new Und

EFCore-脚手架Scaffold发生Build Failed问题的终极解决

大家在使用EntityFrameworkCore的DBFirst的脚手架(Scaffolding)时应该遇到过Build Failed的错误,而没有任何提示,我也遇到过不少次,目前已经完美解决并将排查方法分享给大家: (1)对于要使用脚手架的项目,首先要确保项目是可以正常编译运行的,在VisualStudio中Ctrl+Shift+B进行编译,如果报错,则要先处理好. (2)确保引用的EntityFrameWork相关包完整.正确,以下是我使用的版本: Microsoft.EntityFrame

Android Studio 中 FAILURE: Build failed with an exception. * What went wrong: Execution failed for task ':compileDebugAidl'.的问题解答

Android Studio 中 FAILURE: Build failed with an exception. * What went wrong: Execution failed for task ':compileDebugAidl'.的问题解答 完整的问题提示 Gradle: FAILURE:Build failed with an exception.*What went wrong:Execution failed for task ':compileDebugAidl'.>No

BUILD FAILED D:\build.xml:2: 前言中不允许有内容。

1.错误描述 Microsoft Windows [版本 6.1.7601] 版权所有 (c) 2009 Microsoft Corporation.保留所有权利. C:\Users\Administrator>d: D:\>ant Buildfile: D:\build.xml BUILD FAILED D:\build.xml:2: 前言中不允许有内容. Total time: 0 seconds D:\> 2.错误原因 3.解决办法

cocos2d-x 3.6运行cocos run出现Ndk build failed解决办法

我运行cocos run -p android编译成安卓APK的时候提示:jni/../../Classes/AppDelegate.cpp:67: error: undefined reference to 'GameMain::c reateScene()', 最后出现错误提示:Ndk build failed!,其中GameMain是我自己写的代码,. 后来找到了原因,有两种解决办法: 第一种方法:在\proj.android\jni下面的Android.mk的文件里面,在LOCAL_SR

Android Studio升级后工程Build failed.

最近在升级Android Studio后,发现原先能编译通过的工程,突然就编译不过了,原因是生成的AndroidManifest.xml文件中有乱码. 升级后: android studio 0.6.0 build tools 19.1.0 Android SDK tools 22.6.4. gradle 0.11.+ 错误信息: Error Info Error:(11) Error parsing XML: not well-formed (invalid token) Error:(11)

FAILURE: Build failed with an exception. Crunching Cruncher screen.png failed

自己测试ionic的模板项目cutePuppyPics时,按照https://github.com/driftyco/ionic/blob/2.0/CHANGELOG.md#angular-update-to-200-rc1  升级Angularjs版本后,运行cordova build android 编译项目时总是报如下错 FAILURE: Build failed with an exception. * What went wrong: Execution failed for task

BUILD FAILED D:\build.xml:2: 前言中不同意有内容。

1.错误描写叙述 Microsoft Windows [版本号 6.1.7601] 版权全部 (c) 2009 Microsoft Corporation. 保留全部权利. C:\Users\Administrator>d: D:\>ant Buildfile: D:\build.xml BUILD FAILED D:\build.xml:2: 前言中不同意有内容. Total time: 0 seconds D:\> 2.错误原因 3.解决的方法