Jenkins一键打包unity遇到的坑

记录一个困扰了半天的坑。

Jenkins安装并设置好所有环境变量的前提下,打unity的AssetBundle,发现怎么都无法生成AB资源。然而控制台输出的log日志看起来也是successfully。并且同样的代码和命令行语句,直接在命令行执行就可以打出响应的包,Jenkins却不行,困扰了好久。

这是Jenkins打包之后最后输出的log:

Refresh: detecting if any assets need to be imported or removed ... Refresh: elapses 0.185450 seconds (Nothing changed)
[Package Manager] Server::Kill -- Server was shutdown
Cleanup mono
Exiting batchmode successfully now!
debugger-agent: Unable to listen on 5416
Finished: SUCCESS

可以看到,似乎也是successfully。

但是然后定位到error信息:

-----CompilerOutput:-stdout--exitcode: 1--compilationhadfailure: True--outfile: Temp/Assembly-CSharp.dll
Compilation failed: 1 error(s), 0 warnings
-----CompilerOutput:-stderr----------
error CS0006: Metadata file `C:/WINDOWS/system32/config/systemprofile/AppData/LocalLow/Unity/cache/packages/packages.unity.com/[email protected]/UnityEngine.StandardEvents.dll' could not be found
-----EndCompilerOutput---------------
- Finished compile Library/ScriptAssemblies/Assembly-CSharp.dll
error CS0006: Metadata file `C:/WINDOWS/system32/config/systemprofile/AppData/LocalLow/Unity/cache/packages/packages.unity.com/[email protected]/UnityEngine.StandardEvents.dll' could not be found

可以看到"xxxx could not be found",发现是unity打包环境响应的文件没有找到,但是定位到那个文件夹下,确实是有这个文件的。

一顿百度Google之后,有人说是重置网络,有人说是关闭防火墙,还有说是关闭安全管家,统统试了一遍都不好使。

终于:

下面是解决方法:

————————————————————————————————————————————————————

1. 打开windows服务,找到Jenkins服务。(在运行界面输入services.msc然后回车)


2. 在登录账户页面设置为本机电脑的账户,然后点击确定。(似乎是Jenkins安装的时候自己弄了一个账号,而那个账号无法访问c盘下的文件夹,访问不了unity打包的相关组件)
3. 之后记得重启Jenkins服务
4. 再试试Jenkins打包,是不是ok了呢。

感谢万能的baidu和google吧,这个是搜索关键字:

Jenkins C:\Windows\System32\config\systemprofile could not be found

然后解决的,记录一下吧。

你可能感兴趣的:(Jenkins一键打包unity遇到的坑)