What causes 'The process cannot access the file ... *.pdb' when compiling a MAUI project in Release mode?

dg2k 1,386 Reputation points
  • Visual Studio: Version 17.6.0 Preview 3.0
  • Framework: 8.0.0-preview.1.23110.8
  • Operating System: Windows 11 Enterprise Insider Preview Edition; Version 22H2; OS Build 25336.1000

I am getting this endless compile errors of:
System.IO.IOException: The process cannot access the file 'obj\Release\net8.0-android\android\assets<filename>.pdb' because it is being used by another process.

To give you an example of *pdb files, I had ExoPlayer.pdb and Xamarin.Firebase.Iid.pdb.
When ExoPlayer.pdb was flagged, I unistalled the CommunityToolkit.Maui.MediaElement package if compilation succeeds, but another one popped up -- Xamarin.Firebase.Iid.pdb.

What causes these errors, and what is a workaround?

Visual Studio
Visual Studio
A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.
4,671 questions
A Microsoft open-source framework for building native device applications spanning mobile, tablet, and desktop.
2,961 questions
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,354 questions
0 comments No comments
{count} votes

Accepted answer
  1. Bruce (SqlWork.com) 57,646 Reputation points

    .pdb (debug reference) files are created as part of the build. the error indicates some process has the old file open, so a new one can not be created. you could try to delete the folder first, but it may fail for the same reason. exit programs til the delete works. you can use the openfiles utility to detect which process has the file open:

    note: will need to run the command as admin

0 additional answers

Sort by: Most helpful