Project wont build - Error building Player: ArgumentException: An empty file name is not valid

I’m using Windows and building for Windows Phone. When building, I get 2 errors:

Error building Player: ArgumentException: An empty file name is not valid.
Parameter name: sourceFileName

ArgumentException: An empty file name is not valid.
Parameter name: sourceFileName
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:98)
System.IO.File.Copy (System.String sourceFileName, System.String destFileName) (at /Users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/corlib/System.IO/File.cs:86)
PostProcessWSA.CopyTestCertificate () (at C:/buildslave/unity/build/PlatformDependent/MetroPlayer/Extensions/Managed/PostProcessWSA.cs:231)
PostProcessWinRT.Process () (at C:/buildslave/unity/build/PlatformDependent/WinRT/SharedSources/CSharp/PostProcessWinRT.cs:141)
UnityEditor.Metro.BuildPostprocessor.PostProcess (BuildPostProcessArgs args) (at C:/buildslave/unity/build/PlatformDependent/MetroPlayer/Extensions/Managed/ExtensionModule.cs:133)
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()

I got this error because I didn’t setup properly the WSA certificate in EditProject SettingsPlayerWindows StorePublishingCertificate.

For some reason it was empty. I just chose my existing certificate and built it again successfully. Otherwise, you can try to create a new certificate and select it.

Ok, i found a solution. A dumb one, but it seems to work. You need to create a new project and copy assests from the old one, while building it constantly (copying all assests at once gives the same error).

One solution is to use long path tool is you prefer a hassle free paid option.

Try using long path tool for long paths and character errors.