Errors on building

i tried building a game on unity 2020.2.2f1. Everything works perfect in the editor with no warnings or error but when i try to build it it gives me a lot of errors like these :

  • Unhandled exception. System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
    UnityEditor.BuildPlayerWindow:BuildPlayerAndRun ()

  • —> System.IO.DirectoryNotFoundException: Could not find a part of the path ‘D:\Unity\Unity Projects\LEXIS GAME\Library\ScriptAssemblies\Assembly-CSharp.dll’.
    UnityEditor.BuildPlayerWindow:BuildPlayerAndRun ()

  • at System.IO.FileStream.ValidateFileHandle(SafeFileHandle fileHandle)
    UnityEditor.BuildPlayerWindow:BuildPlayerAndRun ()

  • at System.IO.FileStream.CreateFileOpenHandle(FileMode mode, FileShare share, FileOptions options)
    UnityEditor.BuildPlayerWindow:BuildPlayerAndRun ()

  • at System.IO.FileStream…ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options)
    UnityEditor.BuildPlayerWindow:BuildPlayerAndRun ()

  • at System.IO.FileStream…ctor(String path, FileMode mode, FileAccess access, FileShare share)
    UnityEditor.BuildPlayerWindow:BuildPlayerAndRun ()

*Error building Player: 38 errors

*Build completed with a result of ‘Failed’ in 11 seconds (10911 ms)
UnityEditor.BuildPlayerWindow:BuildPlayerAndRun ()

and so on…anyone knows why do i keep getting all these errors when i get none in editor ???
(btw im trying to build it on windows)

I have the same problem if I press build and run. If I press “build”, then it builds, but when I try to open the game, it opens for a second, than some unity error screen loads up, as shown in the image below, then it closes, and then the unity game gets unresponsive, then unexpectedly closes. I have no whitespace or any form of punctuation in my current game and my other game with whitespace was build perfectly fine. Is there another way to fix this? When I try to build and run, it says "UnityEditor.BuildPlayerWindow + BuildMethodException: 41 Errors. Here are my errors shown in the console.

Unhandled exception. System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
UnityEditor.BuildPlayerWindow:BuildPlayerAndRun ()

—> System.IO.DirectoryNotFoundException: Could not find a part of the path ‘C:\Josh\Website\Joshs Unity games and code\Unity Online Multiplayer FPS Game\Library\ScriptAssemblies\Assembly-CSharp.dll’.
UnityEditor.BuildPlayerWindow:BuildPlayerAndRun ()

at System.IO.FileStream.ValidateFileHandle(SafeFileHandle fileHandle)
UnityEditor.BuildPlayerWindow:BuildPlayerAndRun ()

at System.IO.FileStream.CreateFileOpenHandle(FileMode mode, FileShare share, FileOptions options)
UnityEditor.BuildPlayerWindow:BuildPlayerAndRun ()

at System.IO.FileStream…ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options)
UnityEditor.BuildPlayerWindow:BuildPlayerAndRun ()

at System.IO.FileStream…ctor(String path, FileMode mode, FileAccess access, FileShare share)
UnityEditor.BuildPlayerWindow:BuildPlayerAndRun ()

at Mono.Cecil.ModuleDefinition.GetFileStream(String fileName, FileMode mode, FileAccess access, FileShare share)
UnityEditor.BuildPlayerWindow:BuildPlayerAndRun ()

at Mono.Cecil.ModuleDefinition.ReadModule(String fileName, ReaderParameters parameters)
UnityEditor.BuildPlayerWindow:BuildPlayerAndRun ()

at Mono.Cecil.AssemblyDefinition.ReadAssembly(String fileName, ReaderParameters parameters)
UnityEditor.BuildPlayerWindow:BuildPlayerAndRun ()

at TypeDbJsonGenerator.Program.<>c__DisplayClass4_0.b__1(String x)
UnityEditor.BuildPlayerWindow:BuildPlayerAndRun ()

at System.Linq.Enumerable.WhereSelectArrayIterator`2.ToList()
UnityEditor.BuildPlayerWindow:BuildPlayerAndRun ()

at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
UnityEditor.BuildPlayerWindow:BuildPlayerAndRun ()

at TypeDbJsonGenerator.Program.Read(String pathToAssembly, String searchDirs)
UnityEditor.BuildPlayerWindow:BuildPlayerAndRun ()

at TypeDbJsonGenerator.Program.Main(String args)
UnityEditor.BuildPlayerWindow:BuildPlayerAndRun ()

— End of inner exception stack trace —
UnityEditor.BuildPlayerWindow:BuildPlayerAndRun ()

at System.RuntimeMethodHandle.InvokeMethod(Object target, Object arguments, Signature sig, Boolean constructor, Boolean wrapExceptions)
UnityEditor.BuildPlayerWindow:BuildPlayerAndRun ()

at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object parameters, CultureInfo culture)
UnityEditor.BuildPlayerWindow:BuildPlayerAndRun ()

at System.Reflection.MethodBase.Invoke(Object obj, Object parameters)
UnityEditor.BuildPlayerWindow:BuildPlayerAndRun ()

at Program.Main(String args)
UnityEditor.BuildPlayerWindow:BuildPlayerAndRun ()

—> System.IO.DirectoryNotFoundException: Could not find a part of the path ‘C:\Josh\Website\Joshs Unity games and code\Unity Online Multiplayer FPS Game\Library\PlayerScriptAssemblies\Assembly-CSharp.dll’.
UnityEditor.BuildPlayerWindow:BuildPlayerAndRun ()

Error building Player: 38 errors

Build completed with a result of ‘Failed’ in 11 seconds (10563 ms)
UnityEditor.BuildPlayerWindow:BuildPlayerAndRun ()

UnityEditor.BuildPlayerWindow+BuildMethodException: 41 errors
at UnityEditor.BuildPlayerWindow+DefaultBuildMethods.BuildPlayer (UnityEditor.BuildPlayerOptions options) [0x002ca] in :0
at UnityEditor.BuildPlayerWindow.CallBuildMethods (System.Boolean askForBuildLocation, UnityEditor.BuildOptions defaultBuildOptions) [0x00080] in :0
UnityEditor.BuildPlayerWindow:BuildPlayerAndRun ()