Search Unity

Error MSB3021 Unable to copy file when trying to create App Package

Discussion in 'Windows' started by unity_DROFto-AgKY6Ww, Jan 3, 2020.

  1. unity_DROFto-AgKY6Ww

    unity_DROFto-AgKY6Ww

    Joined:
    Aug 22, 2019
    Posts:
    9
    Problem fixed, info at the bottom

    The files in question are Addressable Assets (image(.png) and soundfile(.ogg)).

    The Addressable Assets are bundled seperately.
    I tried compression: Uncompressed and LZ4.

    I tried compression Method for build: Default and LZ4HC

    The program works when I test it via Visual Studio, only when I try to create the App Package does the error appear.

    When I remove the image file from the project a different image file will be unable to be copied. The strange thing is that most of the files do get copied: In the data folder I have 73 images and in the build folder are 69.

    I tried all architectures (64x 86x, ARM) and the error comes up for all of them, also the problematic file seems to be different most of the time. Sometimes none, one or both sound files are missing.


    Error MSB3021 Unable to copy file "D:\Projects\Unity\..\..\..\..\Data\StreamingAssets\aa\Unknown\WSAPlayer\images_assets_TestImage_a242dfaf7666dade35f01819e994dfb3.bundle"
    to "D:\Projects\Unity\..\..\..\build\obj\..\Win32\Release\PackageLayout\Data\StreamingAssets\aa\Unknown\WSAPlayer\images_assets_TestImage_a242dfaf7666dade35f01819e994dfb3.bundle".
    Could not find a part of the path 'D:\Projects\Unity\..\Builds\HPP_WindowsStore\build\obj\..\Win32\Release\PackageLayout\Data\StreamingAssets\aa\Unknown\WSAPlayer\images_assets_TestImage_a242dfaf7666dade35f01819e994dfb3.bundle'.
    C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VisualStudio\v16.0\AppxPackage\Microsoft.AppXPackage.Targets

    (Could not find a part of the path ...)
    I checked the path and the files are there.

    I tried copying the missing files manually and it works (no permission blocks).

    Interestingly after doing that I get this error:

    Error MSB3231 Unable to remove directory "D:\Projects\Unity\..\Builds\..\build\obj\..\ARM\Release\PackageUploadLayout\".
    Could not find a part of the path 'MusicFile1_f9335b49f834a7d03c047f40312ebb06.bundle'.

    I guess the builder tries to delete everything before rebuilding it and is somehow unable to get to that file.

    Any suggestions on how to fix this?

    Fix:

    I removed the entire build folder and switched to "Master" both in Unity and Visual Studio and the problem is gone.

    Edit: Ok the problem is back. I think it might have to do with deleting Assets for the Store. Some where too large so I deleted them. Deleting and rebuilding everything seems to solve it, still annoying though.
     
    Last edited: Jan 3, 2020
  2. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    7,019
    What exactly you had to delete?
     
  3. unity_DROFto-AgKY6Ww

    unity_DROFto-AgKY6Ww

    Joined:
    Aug 22, 2019
    Posts:
    9
    Assets for the store (in the appmanifest) Large Tile, Wide Tile, App Icon, those things. Large Tile 400x Scale was too large.
     
  4. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    7,019
    You should run them through PNG minimizer or convert them to JPG. You should be able to get them under the limit easily.
     
  5. unity_DROFto-AgKY6Ww

    unity_DROFto-AgKY6Ww

    Joined:
    Aug 22, 2019
    Posts:
    9
    It's not that easy, I did run it through a png minimizer and I am down to 16 Colors, 74 KB for the default scale.

    And the real problem is that once I get that error that an image is too large I start getting the error mentioned in my first post and the only solution right now is to delete everything, rebuild everything, assign 20 images in the manifest again ...

    Oh and the Automatic Asset Generator is a F***ing joke. the original image is 620x620 and 74 KB.

    The generator creates these images:

    Scale 2x : 620x620, 173 KB (Same size as original, somehow more than twice as big)
    Scale 1.5x : 465x465, 425 KB (Yes, the smaller image is somehow larger)
    Scale 1.25x: 388x388, 295 KB
    Scale 1x : 310x310, 185 KB
     
    Last edited: Jan 4, 2020
unityunity