Make sure you don't have files with the same name in different Resources subfolders, like AppIcon and Images.
Maui, files go locked and even Resource Monitor cannot find what is locking it
Severity Code Description Project File Line Suppression State
Error MAUI0000 System.IO.IOException: The process cannot access the file 'C:\Visual Stuido Stuff\Maui\DEVEXFullProject\obj\Debug\net6.0-android\resizetizer\r\drawable-xxxhdpi\nhllogo.png' because it is being used by another process.
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize)
at Microsoft.Maui.Resizetizer.SkiaSharpTools.Save(String destination, SKBitmap tempBitmap) in D:\a_work\1\s\src\SingleProject\Resizetizer\src\SkiaSharpTools.cs:line 143
at Microsoft.Maui.Resizetizer.SkiaSharpTools.Resize(DpiPath dpi, String destination, Double additionalScale, Boolean dpiSizeIsAbsolute) in D:\a_work\1\s\src\SingleProject\Resizetizer\src\SkiaSharpTools.cs:line 64
at Microsoft.Maui.Resizetizer.Resizer.Rasterize(DpiPath dpi, String destination) in D:\a_work\1\s\src\SingleProject\Resizetizer\src\Resizer.cs:line 92
at Microsoft.Maui.Resizetizer.Resizer.Resize(DpiPath dpi, String inputsFile) in D:\a_work\1\s\src\SingleProject\Resizetizer\src\Resizer.cs:line 85
at Microsoft.Maui.Resizetizer.ResizetizeImages.ProcessImageResize(ResizeImageInfo img, DpiPath[] dpis, ConcurrentBag1 resizedImages) in D:\a\_work\1\s\src\SingleProject\Resizetizer\src\ResizetizeImages.cs:line 184 at Microsoft.Maui.Resizetizer.ResizetizeImages.<>c__DisplayClass26_0.<ExecuteAsync>b__0(ResizeImageInfo img) in D:\a\_work\1\s\src\SingleProject\Resizetizer\src\ResizetizeImages.cs:line 86 at Microsoft.Maui.Resizetizer.AsyncTaskExtensions.<>c__DisplayClass0_0
1.<ParallelForEach>b__0(TSource s) in D:\a_work\1\s\src\SingleProject\Resizetizer\src\AsyncTaskExtensions.cs:line 21 DEVEXFullProject C:\Program Files\dotnet\packs\Microsoft.Maui.Resizetizer.Sdk\6.0.486\targets\Microsoft.Maui.Resizetizer.targets 531
All I was trying to do is edit the .csproj file but get the above error.
Developer technologies | .NET | .NET MAUI
3 answers
Sort by: Most helpful
-
-
Richard Dufour 10 Reputation points
2023-05-05T16:33:56.4266667+00:00 These locks are happening because you have 2 file with the same name (i.e. myimage.png and myimage.svg would cause the lock)
Just my 2 cents (seems like a pretty easy fix to me), before locking the file, could VS be a tad smarter and actually consider the file extension??
I'm baffled at how many of these hiccups MAUI is filled with.
-
dg2k 1,416 Reputation points
2022-09-06T07:26:09.967+00:00 @Lloyd Sheen - Try the following:
- Exit Visual Studio.
- Delete the bin and obj folders in your Maui project directory.
- Start Command Prompt cmd with elevated privilege (Run as Administrator)
In the Command Prompt window execute the following two commands (the first is just to change directory to you project folder -- replace the text
<your Maui directory path>
with full path including the drive letter as d:\projects\MyMauiProject. I'm assuming that you're on Windows).cd /d <your Maui directory path>
dotnet restoreStart Visual Studio and compile your code. Use the same method if a similar issue of file lock recurs.