- Home /
Seems to build, shows the following errors
I am trying to build, but I get the following errors, any help appreciated!
IOException: Sharing violation on path Temp\StagingArea\OCEnv_stormcap.exe" or "D:\Tao de Work\UnityProjects\Oldcastle_StormcaptureEnv\Oldcastle\builds5.2\OCEnv_stormcap.exe System.IO.File.Copy (System.String sourceFileName, System.String destFileName, Boolean overwrite) (at /Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/corlib/System.IO/File.cs:124) UnityEditor.FileUtil.UnityFileCopy (System.String from, System.String to, Boolean overwrite) (at C:/buildslave/unity/build/Editor/Mono/FileUtil.cs:207) UnityEditor.FileUtil.CopyDirectoryFiltered (System.String source, System.String target, Boolean overwrite, System.Func`2 includeCallback, Boolean recursive) (at C:/buildslave/unity/build/Editor/Mono/FileUtil.cs:142) DesktopStandalonePostProcessor.CopyStagingAreaIntoDestination () (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/DesktopStandalonePostProcessor.cs:194) DesktopStandalonePostProcessor.PostProcess () (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/DesktopStandalonePostProcessor.cs:25) UnityEditor.WindowsStandalone.WindowsDesktopStandalonePostProcessor.PostProcess (BuildPostProcessArgs args) UnityEditor.PostprocessBuildPlayer.Postprocess (BuildTarget target, System.String installPath, System.String companyName, System.String productName, Int32 width, Int32 height, System.String downloadWebplayerUrl, System.String manualDownloadWebplayerUrl, BuildOptions options, UnityEditor.RuntimeClassRegistry usedClassRegistry) (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/PostprocessBuildPlayer.cs:316) UnityEditor.HostView:OnGUI()
AND
Error building Player: IOException: Sharing violation on path Temp\StagingArea\OCEnv_stormcap.exe" or "D:\Tao de Work\UnityProjects\Oldcastle_StormcaptureEnv\Oldcastle\builds5.2\OCEnv_stormcap.exe
What platform are you building to? PC? Are you trying to overwrite an existing build? Try a different directory.
Try closing Unity, deleting the Library and Temp folders and then restarting Unity so that it recreates them.
Answer by Bonfire-Boy · Nov 26, 2015 at 09:35 AM
It looks like it's having trouble with the file system and it specifies 2 possible files that are causing the problem.
One of them looks like it's the exe that's being built. So check the permissions on the directory, and if you're overwriting a previous build then check you have permissions to do so (or, better yet IMO, don't overwrite an existing build).
The other file it mentions is in Unity's Temp folder. Sometimes a failed build leaves stuff in there that confuses future builds. To fix this, close Unity, delete the Library and Temp folders, and then restart Unity so that it recreates them from scratch.
That helped clear out the main body of the errors, Thanks- I think it is a compound problem that includes the piece addressed below, Thanks for the help!
Answer by Bunny83 · Nov 26, 2015 at 12:31 PM
A "sharing violation" indicates that another application has an active handle to a file you try to access. In windows when you run a program the system actually hold a handle to the exe file and keep it locked while the application is running. When you build your game it's actually build inside that temp folder. When it's done it copies the result over to the destination folder. Since the error happens inside "System.IO.File.Copy" it's most likely that your old build is still running.
Keep in mind that "running" doesn't mean that you necessarily have to see a window. If your game had a problem it's possible that it still runs in the background without an active / visible window. So make sure your game application doesn't run when you create a build. Just check the TaskManager's details tab and search for your file. Don't rely on the processes tab as it only shows "apps" that have a window.
Thanks for the insight, I am running 7, I never wanted 8 and haven't gotten around to getting 10 , so I don't have a details tab in my task manager. However, it seems that (after the helpful rebuild Library idea) the build that I have has 3 processes that seem to stop before loading much into memory (about 120k, whereas a working version of this exe loads about 500$$anonymous$$b) and cant be ended from within task manager. Strangely, a version that is opened after the first one has hung opens and runs normally (0_0) so it sounds like you have something there with your suggestion. Any help on how I might address this would be appreciated. Thanks again!
I always had trouble with Task $$anonymous$$anager in W7. There's a free alternative called Process Explorer that I found better for this kind of thing (better at killing processes as well as finding them).