[SOLVED] Package Manager including missing packages that break automated builds

I’ve got a Jenkins configuration set up to build our game on Lin/Mac/Win and upload each build to Steam. Lately, our builds have been crashing with relevant output as follows:

First, early on in the build, I see the following…

DisplayProgressbar: Unity Package Manager
[Package Manager] Resolving 3 packages:
[Package Manager]  * Package :  com.unity.ads@1.0.7
    (location: C:\WINDOWS\system32\config\systemprofile\AppData\LocalLow\Unity\cache\packages\packages.unity.com\com.unity.ads@1.0.7)
[Package Manager]  * Package :  com.unity.analytics@1.0.1
    (location: C:\WINDOWS\system32\config\systemprofile\AppData\LocalLow\Unity\cache\packages\packages.unity.com\com.unity.analytics@1.0.1)
[Package Manager]  * Package :  com.unity.purchasing@1.0.1
    (location: C:\WINDOWS\system32\config\systemprofile\AppData\LocalLow\Unity\cache\packages\packages.unity.com\com.unity.purchasing@1.0.1)
[Package Manager] Resolve completed

Later, the build crashes with the following lines…

error CS0006: Metadata file `C:/WINDOWS/system32/config/systemprofile/AppData/LocalLow/Unity/cache/packages/packages.unity.com/com.unity.analytics@1.0.1/UnityEngine.Analytics.dll' could not be found
error CS0006: Metadata file `C:/WINDOWS/system32/config/systemprofile/AppData/LocalLow/Unity/cache/packages/packages.unity.com/com.unity.purchasing@1.0.1/UnityEngine.Purchasing.dll' could not be found

However, in our Services window, both Ads and Analytics are set to “Off.”

Possibly of note: we recently pulled Firebase support into the project for our iOS builds; is it possible that this plugin is having an effect on the build? Where can I access the Package Manager to potentially disable the inclusion of these packages?

Are you able to test with 2017.3 ?

Hmm… don’t have it installed, but I can give it a shot and see what’s kicking.

Hm… unfortunately I still get the error when building with Unity 2017.3.0f2.

-----CompilerOutput:-stdout--exitcode: 1--compilationhadfailure: True--outfile: Temp/Assembly-CSharp.dll
Compilation failed: 3 error(s), 0 warnings
-----CompilerOutput:-stderr----------
error CS0006: Metadata file `C:/WINDOWS/system32/config/systemprofile/AppData/LocalLow/Unity/cache/packages/packages.unity.com/com.unity.ads@2.0.0/Editor/UnityEditor.Advertisements.dll' could not be found
error CS0006: Metadata file `C:/WINDOWS/system32/config/systemprofile/AppData/LocalLow/Unity/cache/packages/packages.unity.com/com.unity.analytics@0.0.19/Editor/UnityEditor.Analytics.dll' could not be found
error CS0006: Metadata file `C:/WINDOWS/system32/config/systemprofile/AppData/LocalLow/Unity/cache/packages/packages.unity.com/com.unity.purchasing@0.0.19/Editor/UnityEditor.Purchasing.dll' could not be found
-----EndCompilerOutput---------------

One interesting thing I’m noticing: it works fine when I build from the editor, but when I automate the build through Jenkins it gives the above errors. Gonna look into that.

Running into similar errors (currently on Unity 2017.2) – in our case, it looks like Unity services is randomly disconnecting on our build server machines, and when it fails to connect the service, it will remove those dll files.

Do you have warnings suppressed (and/or did you modify PurchasingCheck.cs)? We usually have this warning (formerly an error in previous Unity versions):

Assets/PlugIns/UnityPurchasing/script/PurchasingCheck.cs(3,0): warning CS1030: #warning: `"Unity IAP plugin is installed, but Unity IAP is not enabled. Please enable Unity IAP in the Services window."'

New wrinkle – for a recent Android compile it was able to perform the initial compile and start our build script, but when we go to build a (legacy) scene bundle it shows “UNITY_PURCHASING” and “UNITY_ANALYTICS” still in the define list (and therefore didn’t throw the above warning), but still fails to find the dll files. We’ve also had some runs where it initially throws that warning during the initial Unity launch compiles, but the scene/app compiles later are ok.

We’re having this problem too. Pretty bad as we only build via automation. Only started happening as we upgraded to 2017.2.

I’m still getting what looks like a related error in my (Jenkins) automated builds, in Unity 2017.3.0f3, with Firebase removed and all Unity cloud services disabled.

-----CompilerOutput:-stdout--exitcode: 1--compilationhadfailure: True--outfile: Temp/Assembly-CSharp-firstpass.dll
Compilation failed: 7 error(s), 0 warnings
-----CompilerOutput:-stderr----------
error CS0006: Metadata file `C:/WINDOWS/system32/config/systemprofile/AppData/LocalLow/Unity/cache/packages/packages.unity.com/com.unity.ads@2.0.3/UnityEngine.Advertisements.dll' could not be found
error CS0006: Metadata file `C:/WINDOWS/system32/config/systemprofile/AppData/LocalLow/Unity/cache/packages/packages.unity.com/com.unity.ads@2.0.3/Editor/UnityEditor.Advertisements.dll' could not be found
error CS0006: Metadata file `C:/WINDOWS/system32/config/systemprofile/AppData/LocalLow/Unity/cache/packages/packages.unity.com/com.unity.analytics@2.0.13/UnityEngine.Analytics.dll' could not be found
error CS0006: Metadata file `C:/WINDOWS/system32/config/systemprofile/AppData/LocalLow/Unity/cache/packages/packages.unity.com/com.unity.analytics@2.0.13/Editor/UnityEditor.Analytics.dll' could not be found
error CS0006: Metadata file `C:/WINDOWS/system32/config/systemprofile/AppData/LocalLow/Unity/cache/packages/packages.unity.com/com.unity.purchasing@0.0.19/UnityEngine.Purchasing.dll' could not be found
error CS0006: Metadata file `C:/WINDOWS/system32/config/systemprofile/AppData/LocalLow/Unity/cache/packages/packages.unity.com/com.unity.purchasing@0.0.19/Editor/UnityEditor.Purchasing.dll' could not be found
error CS0006: Metadata file `C:/WINDOWS/system32/config/systemprofile/AppData/LocalLow/Unity/cache/packages/packages.unity.com/com.unity.standardevents@1.0.10/UnityEngine.StandardEvents.dll' could not be found
-----EndCompilerOutput---------------
- Finished compile Library/ScriptAssemblies/Assembly-CSharp-firstpass.dll
error CS0006: Metadata file `C:/WINDOWS/system32/config/systemprofile/AppData/LocalLow/Unity/cache/packages/packages.unity.com/com.unity.ads@2.0.3/UnityEngine.Advertisements.dll' could not be found
error CS0006: Metadata file `C:/WINDOWS/system32/config/systemprofile/AppData/LocalLow/Unity/cache/packages/packages.unity.com/com.unity.ads@2.0.3/Editor/UnityEditor.Advertisements.dll' could not be found
error CS0006: Metadata file `C:/WINDOWS/system32/config/systemprofile/AppData/LocalLow/Unity/cache/packages/packages.unity.com/com.unity.analytics@2.0.13/UnityEngine.Analytics.dll' could not be found
error CS0006: Metadata file `C:/WINDOWS/system32/config/systemprofile/AppData/LocalLow/Unity/cache/packages/packages.unity.com/com.unity.analytics@2.0.13/Editor/UnityEditor.Analytics.dll' could not be found
error CS0006: Metadata file `C:/WINDOWS/system32/config/systemprofile/AppData/LocalLow/Unity/cache/packages/packages.unity.com/com.unity.purchasing@0.0.19/UnityEngine.Purchasing.dll' could not be found
error CS0006: Metadata file `C:/WINDOWS/system32/config/systemprofile/AppData/LocalLow/Unity/cache/packages/packages.unity.com/com.unity.purchasing@0.0.19/Editor/UnityEditor.Purchasing.dll' could not be found
error CS0006: Metadata file `C:/WINDOWS/system32/config/systemprofile/AppData/LocalLow/Unity/cache/packages/packages.unity.com/com.unity.standardevents@1.0.10/UnityEngine.StandardEvents.dll' could not be found

Compilation failed: 7 error(s), 0 warnings

(Filename:  Line: 0)

Error: System.IO.FileNotFoundException: Could not load file or assembly 'C:/WINDOWS/system32/config/systemprofile/AppData/LocalLow/Unity/cache/packages/packages.unity.com/com.unity.ads@2.0.3/UnityEngine.Advertisements.dll' or one of its dependencies. The system cannot find the file specified.
File name: 'C:/WINDOWS/system32/config/systemprofile/AppData/LocalLow/Unity/cache/packages/packages.unity.com/com.unity.ads@2.0.3/UnityEngine.Advertisements.dll'
  at System.AppDomain.Load (System.String assemblyString, System.Security.Policy.Evidence assemblySecurity, Boolean refonly) [0x00000] in <filename unknown>:0
  at System.AppDomain.Load (System.String assemblyString) [0x00000] in <filename unknown>:0
  at (wrapper remoting-invoke-with-check) System.AppDomain:Load (string)
  at System.Reflection.Assembly.Load (System.String assemblyString) [0x00000] in <filename unknown>:0
  at us.UnityScriptCompilerFactoryModule.loadAssembly (System.String name) [0x00000] in <filename unknown>:0
  at us.UnityScriptCompilerFactory.FromCommandLineOptions (us.CommandLineOptions options) [0x00000] in <filename unknown>:0
  at us.UsModule.compile (us.CommandLineOptions options) [0x00000] in <filename unknown>:0
  at us.UsModule.runWithCommandLine (System.String[] commandLine) [0x00000] in <filename unknown>:0
  at us.UsModule.Main (System.String[] argv) [0x00000] in <filename unknown>:0

(Filename:  Line: 0)
-----EndCompilerOutput---------------

I believe it is something to do with running under the SYSTEM account and/or as a service. We are using TeamCity 2017.1.4 and we have the same issue.

[Package Manager] Server::EnsureServerProcessIsRunning -- ReadyRequest exceeded maximum alloted time, ran for [23] seconds
[Package Manager] Server::Kill -- Server was shutdown
[Package Manager] PackageManager Server::Start -- Process restart attempt #2

[Package Manager] Server::Start -- Port 49596 was selected
DisplayProgressbar: Unity Package Manager
[Package Manager] Resolving 4 packages:
[Package Manager]  * Package :  com.unity.ads@2.0.3
    (location: C:\Windows\system32\config\systemprofile\AppData\LocalLow\Unity\cache\packages\packages.unity.com\com.unity.ads@2.0.3)
[Package Manager]  * Package :  com.unity.analytics@2.0.13
    (location: C:\Windows\system32\config\systemprofile\AppData\LocalLow\Unity\cache\packages\packages.unity.com\com.unity.analytics@2.0.13)
[Package Manager]  * Package :  com.unity.purchasing@0.0.19
    (location: C:\Windows\system32\config\systemprofile\AppData\LocalLow\Unity\cache\packages\packages.unity.com\com.unity.purchasing@0.0.19)
[Package Manager]  * Package :  com.unity.standardevents@1.0.10
    (location: C:\Windows\system32\config\systemprofile\AppData\LocalLow\Unity\cache\packages\packages.unity.com\com.unity.standardevents@1.0.10)
[Package Manager] Resolve completed
Initialize engine version: 2017.3.0f3 (a9f86dcd79df)

Same end error as yours.

Do you mean running Jenkins or something else as such?

Anyway, as I mentioned above, the project builds fine manually, but fails to build via Jenkins. Our automated builds for three platforms (Lin/Mac/Win), so I tried building those three manually, then running the automated build again. When I did that, I got only one error, related to the StandardEvents library:

-----CompilerOutput:-stdout--exitcode: 1--compilationhadfailure: True--outfile: Temp/Assembly-CSharp-firstpass.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/com.unity.standardevents@1.0.10/UnityEngine.StandardEvents.dll' could not be found
-----EndCompilerOutput---------------
- Finished compile Library/ScriptAssemblies/Assembly-CSharp-firstpass.dll
error CS0006: Metadata file `C:/WINDOWS/system32/config/systemprofile/AppData/LocalLow/Unity/cache/packages/packages.unity.com/com.unity.standardevents@1.0.10/UnityEngine.StandardEvents.dll' could not be found

Compilation failed: 1 error(s), 0 warnings
(Filename:  Line: 0)

Error: System.IO.FileNotFoundException: Could not load file or assembly 'C:/WINDOWS/system32/config/systemprofile/AppData/LocalLow/Unity/cache/packages/packages.unity.com/com.unity.standardevents@1.0.10/UnityEngine.StandardEvents.dll' or one of its dependencies. The system cannot find the file specified.
File name: 'C:/WINDOWS/system32/config/systemprofile/AppData/LocalLow/Unity/cache/packages/packages.unity.com/com.unity.standardevents@1.0.10/UnityEngine.StandardEvents.dll'
  at System.AppDomain.Load (System.String assemblyString, System.Security.Policy.Evidence assemblySecurity, Boolean refonly) [0x00000] in <filename unknown>:0
  at System.AppDomain.Load (System.String assemblyString) [0x00000] in <filename unknown>:0
  at (wrapper remoting-invoke-with-check) System.AppDomain:Load (string)
  at System.Reflection.Assembly.Load (System.String assemblyString) [0x00000] in <filename unknown>:0
  at us.UnityScriptCompilerFactoryModule.loadAssembly (System.String name) [0x00000] in <filename unknown>:0
  at us.UnityScriptCompilerFactory.FromCommandLineOptions (us.CommandLineOptions options) [0x00000] in <filename unknown>:0
  at us.UsModule.compile (us.CommandLineOptions options) [0x00000] in <filename unknown>:0
  at us.UsModule.runWithCommandLine (System.String[] commandLine) [0x00000] in <filename unknown>:0
  at us.UsModule.Main (System.String[] argv) [0x00000] in <filename unknown>:0
(Filename:  Line: 0)

DisplayProgressNotification: Build Failed
Error building Player because scripts had compiler errors

However, every subsequent automated build after that (without performing manual builds) gave me the original errors related to some Unity services:

-----CompilerOutput:-stdout--exitcode: 1--compilationhadfailure: True--outfile: Temp/Assembly-CSharp-firstpass.dll
Compilation failed: 7 error(s), 0 warnings
-----CompilerOutput:-stderr----------
error CS0006: Metadata file `C:/WINDOWS/system32/config/systemprofile/AppData/LocalLow/Unity/cache/packages/packages.unity.com/com.unity.ads@2.0.3/UnityEngine.Advertisements.dll' could not be found
error CS0006: Metadata file `C:/WINDOWS/system32/config/systemprofile/AppData/LocalLow/Unity/cache/packages/packages.unity.com/com.unity.ads@2.0.3/Editor/UnityEditor.Advertisements.dll' could not be found
error CS0006: Metadata file `C:/WINDOWS/system32/config/systemprofile/AppData/LocalLow/Unity/cache/packages/packages.unity.com/com.unity.analytics@2.0.13/UnityEngine.Analytics.dll' could not be found
error CS0006: Metadata file `C:/WINDOWS/system32/config/systemprofile/AppData/LocalLow/Unity/cache/packages/packages.unity.com/com.unity.analytics@2.0.13/Editor/UnityEditor.Analytics.dll' could not be found
error CS0006: Metadata file `C:/WINDOWS/system32/config/systemprofile/AppData/LocalLow/Unity/cache/packages/packages.unity.com/com.unity.purchasing@0.0.19/UnityEngine.Purchasing.dll' could not be found
error CS0006: Metadata file `C:/WINDOWS/system32/config/systemprofile/AppData/LocalLow/Unity/cache/packages/packages.unity.com/com.unity.purchasing@0.0.19/Editor/UnityEditor.Purchasing.dll' could not be found
error CS0006: Metadata file `C:/WINDOWS/system32/config/systemprofile/AppData/LocalLow/Unity/cache/packages/packages.unity.com/com.unity.standardevents@1.0.10/UnityEngine.StandardEvents.dll' could not be found
-----EndCompilerOutput---------------
- Finished compile Library/ScriptAssemblies/Assembly-CSharp-firstpass.dll
error CS0006: Metadata file `C:/WINDOWS/system32/config/systemprofile/AppData/LocalLow/Unity/cache/packages/packages.unity.com/com.unity.ads@2.0.3/UnityEngine.Advertisements.dll' could not be found
error CS0006: Metadata file `C:/WINDOWS/system32/config/systemprofile/AppData/LocalLow/Unity/cache/packages/packages.unity.com/com.unity.ads@2.0.3/Editor/UnityEditor.Advertisements.dll' could not be found
error CS0006: Metadata file `C:/WINDOWS/system32/config/systemprofile/AppData/LocalLow/Unity/cache/packages/packages.unity.com/com.unity.analytics@2.0.13/UnityEngine.Analytics.dll' could not be found
error CS0006: Metadata file `C:/WINDOWS/system32/config/systemprofile/AppData/LocalLow/Unity/cache/packages/packages.unity.com/com.unity.analytics@2.0.13/Editor/UnityEditor.Analytics.dll' could not be found
error CS0006: Metadata file `C:/WINDOWS/system32/config/systemprofile/AppData/LocalLow/Unity/cache/packages/packages.unity.com/com.unity.purchasing@0.0.19/UnityEngine.Purchasing.dll' could not be found
error CS0006: Metadata file `C:/WINDOWS/system32/config/systemprofile/AppData/LocalLow/Unity/cache/packages/packages.unity.com/com.unity.purchasing@0.0.19/Editor/UnityEditor.Purchasing.dll' could not be found
error CS0006: Metadata file `C:/WINDOWS/system32/config/systemprofile/AppData/LocalLow/Unity/cache/packages/packages.unity.com/com.unity.standardevents@1.0.10/UnityEngine.StandardEvents.dll' could not be found

Compilation failed: 7 error(s), 0 warnings
(Filename:  Line: 0)

Error: System.IO.FileNotFoundException: Could not load file or assembly 'C:/WINDOWS/system32/config/systemprofile/AppData/LocalLow/Unity/cache/packages/packages.unity.com/com.unity.ads@2.0.3/UnityEngine.Advertisements.dll' or one of its dependencies. The system cannot find the file specified.
File name: 'C:/WINDOWS/system32/config/systemprofile/AppData/LocalLow/Unity/cache/packages/packages.unity.com/com.unity.ads@2.0.3/UnityEngine.Advertisements.dll'
  at System.AppDomain.Load (System.String assemblyString, System.Security.Policy.Evidence assemblySecurity, Boolean refonly) [0x00000] in <filename unknown>:0
  at System.AppDomain.Load (System.String assemblyString) [0x00000] in <filename unknown>:0
  at (wrapper remoting-invoke-with-check) System.AppDomain:Load (string)
  at System.Reflection.Assembly.Load (System.String assemblyString) [0x00000] in <filename unknown>:0
  at us.UnityScriptCompilerFactoryModule.loadAssembly (System.String name) [0x00000] in <filename unknown>:0
  at us.UnityScriptCompilerFactory.FromCommandLineOptions (us.CommandLineOptions options) [0x00000] in <filename unknown>:0
  at us.UsModule.compile (us.CommandLineOptions options) [0x00000] in <filename unknown>:0
  at us.UsModule.runWithCommandLine (System.String[] commandLine) [0x00000] in <filename unknown>:0
  at us.UsModule.Main (System.String[] argv) [0x00000] in <filename unknown>:0
(Filename:  Line: 0)

Validating Project structure ... 0.359366 seconds.
[...]

Scripts have compiler errors.
(Filename: C:\buildslave\unity\build\Runtime/Utilities/Argv.cpp Line: 226)


Aborting batchmode due to failure:
Scripts have compiler errors.

Not sure why there’s a difference there, but I found it interesting that the Unity services only show up as errors after one run of the automated build.

try this

I mean that is what we both have in common. It’s nothing to do with Jenkins or TeamCity, but instead something to do with batchmode building under the SYSTEM account or as a service.

1 Like

Hi everyone. We’re facing the same issue with 2017.3.0f3 using Quickbuild too. Did you found any workaround ?

If you can change the user that it runs under from SYSTEM to another user, but this isn’t feasable for us cause we use TeamCity, so waiting on someone at Unity to get back to us. Could you create a bug report and post the number so we can upvote it?

Hi Stormy102, I tried several configurations but like you it works using the command line as admin, but not through Quickbuild. I can create a bug report but maybe someone here already done it ? If not I’ll do it tomorrow.

Having the same problem here with Teamcity 2017.2.1 and Unity 2017.3.0f3.

2 Likes

For now my only solution has been:
~ clone the project to a separate folder (“MyGame” and “MyGame-builds,” for instance)
~ add an editor window & button for builds
~ copy all of my command-line build script into the latter button
~ open the editor and hit the “build” button in my build directory, while i continue to work in the main/non-build directory

…which is hardly a solution, per se.

1 Like

Hi posted a bug report but it’s not yet available in issue tracker. I’ll let you know as soon as I can find a link for you.

@nickfourtimes1 > Thanks for the workaround, but sadly it won’t work for us as our build robot was aimed to check compilations at every new submit on various targets and automated daily build :frowning:

@kookyoo Does Quickbuild run as a Windows service? If so, a temporary workaround might be to change the user account from SYSTEM.

Overall, this appears to affect lots of automated systems which run as a service under the SYSTEM, which is why the errors reference the SYSTEM account AppData

C:/WINDOWS/system32/config/systemprofile/AppData/LocalLow/Unity

Does this happen to anybody on a non-Windows system? @kookyoo @nickfourtimes1 @hexaust

1 Like