Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exception: Must set an output directory through SetCompileScriptsOutputDirectory before compiling #538

Closed
Tuntenfisch opened this issue Jul 14, 2023 · 1 comment · Fixed by #691

Comments

@Tuntenfisch
Copy link

Tuntenfisch commented Jul 14, 2023

Description

  • NuGetForUnity Version: 3.1.0
  • Unity Version: 2022.3.3f1
  • Operating System: Windows Version 22H2 (OS Build 19045.3208)

I have a Unity project with NuGetForUnity and the following packages:

  • "Docker.DotNet" version="3.125.14"
  • "Newtonsoft.Json" version="13.0.3"
  • "System.CommandLine" version="2.0.0-beta4.22272.1"

The project is versioned using Git on a private GitLab and when I clone the repository and import it in Unity for the very first time, I get the following exception:

Exception: Must set an output directory through SetCompileScriptsOutputDirectory before compiling
UnityEditor.Scripting.ScriptCompilation.EditorCompilation.GetCompileScriptsOutputDirectory () (at <0cbf2453ffe348b8bff59f7f22a27d4b>:0)
UnityEditor.Scripting.ScriptCompilation.EditorCompilation.CreateScriptAssemblySettings (UnityEditor.BuildTargetGroup buildTargetGroup, UnityEditor.BuildTarget buildTarget, UnityEditor.Scripting.ScriptCompilation.EditorScriptCompilationOptions options, System.String[] extraScriptingDefines) (at <0cbf2453ffe348b8bff59f7f22a27d4b>:0)
UnityEditor.Scripting.ScriptCompilation.EditorCompilation.CreateScriptAssemblySettings (UnityEditor.BuildTargetGroup buildTargetGroup, UnityEditor.BuildTarget buildTarget, UnityEditor.Scripting.ScriptCompilation.EditorScriptCompilationOptions options) (at <0cbf2453ffe348b8bff59f7f22a27d4b>:0)
UnityEditor.Scripting.ScriptCompilation.EditorCompilation.CreateEditorScriptAssemblySettings (UnityEditor.Scripting.ScriptCompilation.EditorScriptCompilationOptions options) (at <0cbf2453ffe348b8bff59f7f22a27d4b>:0)
UnityEditor.Scripting.ScriptCompilation.EditorCompilation.GetAllScriptAssemblies (UnityEditor.Scripting.ScriptCompilation.EditorScriptCompilationOptions options, UnityEditor.Scripting.ScriptCompilation.PrecompiledAssembly[] unityAssembliesArg, System.Collections.Generic.Dictionary`2[TKey,TValue] precompiledAssembliesArg, System.String[] defines) (at <0cbf2453ffe348b8bff59f7f22a27d4b>:0)
UnityEditor.Compilation.CompilationPipeline.GetScriptAssemblies (UnityEditor.Scripting.ScriptCompilation.IEditorCompilation editorCompilation, UnityEditor.Scripting.ScriptCompilation.EditorScriptCompilationOptions options, System.String[] extraScriptingDefines) (at <0cbf2453ffe348b8bff59f7f22a27d4b>:0)
UnityEditor.Compilation.CompilationPipeline.GetScriptAssemblies (UnityEditor.Scripting.ScriptCompilation.IEditorCompilation editorCompilation, UnityEditor.Compilation.AssembliesType assembliesType, System.String[] extraScriptingDefines) (at <0cbf2453ffe348b8bff59f7f22a27d4b>:0)
UnityEditor.Compilation.CompilationPipeline.GetAssemblies (UnityEditor.Scripting.ScriptCompilation.EditorCompilation editorCompilation, UnityEditor.Compilation.AssembliesType assembliesType, System.String[] extraScriptingDefines) (at <0cbf2453ffe348b8bff59f7f22a27d4b>:0)
UnityEditor.Compilation.CompilationPipeline.GetAssemblies (UnityEditor.Compilation.AssembliesType assembliesType) (at <0cbf2453ffe348b8bff59f7f22a27d4b>:0)
NugetForUnity.UnityPreImportedLibraryResolver.GetAlreadyImportedLibs () (at ./Library/PackageCache/com.github-glitchenzo.nugetforunity@03353e7a94/Editor/UnityPreImportedLibraryResolver.cs:46)
NugetForUnity.UnityPreImportedLibraryResolver.GetAlreadyImportedEditorOnlyLibraries () (at ./Library/PackageCache/com.github-glitchenzo.nugetforunity@03353e7a94/Editor/UnityPreImportedLibraryResolver.cs:90)
NugetForUnity.NugetPackageAssetPostprocessor+<HandleAsset>d__6.MoveNext () (at ./Library/PackageCache/com.github-glitchenzo.nugetforunity@03353e7a94/Editor/NugetPackageAssetPostprocessor.cs:128)
System.Linq.Lookup`2[TKey,TElement].Create (System.Collections.Generic.IEnumerable`1[T] source, System.Func`2[T,TResult] keySelector, System.Collections.Generic.IEqualityComparer`1[T] comparer) (at <7b5547b4335144ceb60840e62be9f312>:0)
System.Linq.GroupedEnumerable`2[TSource,TKey].GetEnumerator () (at <7b5547b4335144ceb60840e62be9f312>:0)
NugetForUnity.NugetPackageAssetPostprocessor.LogResults (System.Collections.Generic.IEnumerable`1[T] results) (at ./Library/PackageCache/com.github-glitchenzo.nugetforunity@03353e7a94/Editor/NugetPackageAssetPostprocessor.cs:256)
NugetForUnity.NugetPackageAssetPostprocessor.OnPreprocessAsset () (at ./Library/PackageCache/com.github-glitchenzo.nugetforunity@03353e7a94/Editor/NugetPackageAssetPostprocessor.cs:67)
System.Reflection.RuntimeMethodInfo.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at <605bf8b31fcb444b85176da963870aa7>:0)
Rethrow as TargetInvocationException: Exception has been thrown by the target of an invocation.
System.Reflection.RuntimeMethodInfo.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at <605bf8b31fcb444b85176da963870aa7>:0)
System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) (at <605bf8b31fcb444b85176da963870aa7>:0)
UnityEditor.AssetPostprocessingInternal.InvokeMethodIfAvailable (System.Object target, System.String methodName, System.Object[] args) (at <0cbf2453ffe348b8bff59f7f22a27d4b>:0)
UnityEditor.AssetPostprocessingInternal.PreprocessAsset () (at <0cbf2453ffe348b8bff59f7f22a27d4b>:0)

While this exception can simply be ignored, it's still confusing to other people setting up the repository. Is there anything that can be done?

@friflo
Copy link

friflo commented Feb 29, 2024

Same with my project.
To reproduce simply removed all unversioned (git) files and open the project.
Seems that the dll's in the Packages folder are not available when compiling Assets scripts runs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants