Error when building game: 'IOException: Sharing violation on path'

Hey everyone!

I have a major issue with my 2d platformer game. It’s completely finished now and has worked absolutely fine both in-editor and when building until now. When I press Ctrl + B to build it, the loading bar reaches the end and gives me these errors:

‘IOException: Sharing violation on path Temp\StagingArea\Pippy The Bird.exe" or "C:\Users\Adam\Desktop\Unity Game Build\Pippy The Bird.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) (at C:/buildslave/unity/build/PlatformDependent/WinPlayer/Extensions/Managed/WindowsDesktopStandalonePostProcessor.cs:131)
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.BuildPlayerWindow:BuildPlayerAndRun()’

And:

‘Error building Player: IOException: Sharing violation on path Temp\StagingArea\Pippy The Bird.exe" or "C:\Users\Adam\Desktop\Unity Game Build\Pippy The Bird.exe’

I’ve even tried building to a folder on two different PCs, and it builds fine with no errors… Until I go to play the exported game and my mouse curser just spins endlessly and it never loads. If I restart windows explorer in task manager it’s like I never tried to run the game in the first palce.

Please can someone help me here! I’ve literally finished my game for a project now, and the only thing stopping me from being able to hand in is building the thing as a .exe. :confused:

1 Like

i would guess that the game is still open, when the editor tries to overwrite it, while copying it to the target path. Maybe it didn’t close properly.

1 Like

I’ve figured out from restoring from an earlier backup: If I build the game without a custom logo it works fine, however the moment I apply a new picture/texture for the .exe’s launcher icon in the Unity Build Settings tab it causes all of these issues. It’s completely bizarre, but is something I would like to amend!!

1 Like