MSB3231 – Unable to remove directory

I was trying to build a Universal App by using a TFS build agent. It fails with the following exception:

Microsoft.AppXPackage.Targets(2883,5): error MSB3231: Unable to remove directory “obj\x64\Release\PackageUploadLayout\”. Access to the path denied

I solved that by deleting the PackageUploadLayout directory by a script added to the Pre-Build event of the Visual Studio Project. The script deletes every sub folder of the solution with that name.

cd /d $(SolutionDir)
for /d /r . %%d in (PackageUploadLayout) do @if exist "%%d" rd /s/q "%%d"


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: