dotnet / android

.NET for Android provides open-source bindings of the Android SDK for use with .NET managed languages such as C#
MIT License
1.93k stars 533 forks source link

MAUI - Access to the path .dll is denied #9426

Closed vsfeedback closed 1 week ago

vsfeedback commented 1 month ago

This issue has been moved from a ticket on Developer Community.


I created new Maui project and I cannot work due to error. After start debugging, stop, and try to run again.

System.UnauthorizedAccessException: Access to the path 'C:\Users\xxx\source\repos\MauiSygic\obj\Debug\net9.0-android\android\assets\arm64-v8a\Mauixxx.dll' is denied.
1>C:\Program Files\dotnet\packs\Microsoft.Android.Sdk.Windows\35.0.0-rc.1.80\tools\Xamarin.Android.Common.targets(1415,3): error XALNS7019:    at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
1>C:\Program Files\dotnet\packs\Microsoft.Android.Sdk.Windows\35.0.0-rc.1.80\tools\Xamarin.Android.Common.targets(1415,3): error XALNS7019:    at System.IO.File.InternalDelete(String path, Boolean checkHost)
1>C:\Program Files\dotnet\packs\Microsoft.Android.Sdk.Windows\35.0.0-rc.1.80\tools\Xamarin.Android.Common.targets(1415,3): error XALNS7019:    at Microsoft.Android.Build.Tasks.Files.CopyIfChanged(String source, String destination) in /Users/runner/work/1/s/xamarin-android/external/xamarin-android-tools/src/Microsoft.Android.Build.BaseTasks/Files.cs:line 125
1>C:\Program Files\dotnet\packs\Microsoft.Android.Sdk.Windows\35.0.0-rc.1.80\tools\Xamarin.Android.Common.targets(1415,3): error XALNS7019:    at Xamarin.Android.Tasks.MonoAndroidHelper.CopyAssemblyAndSymbols(String source, String destination) in /Users/runner/work/1/s/xamarin-android/src/Xamarin.Android.Build.Tasks/Utilities/MonoAndroidHelper.cs:line 344
1>C:\Program Files\dotnet\packs\Microsoft.Android.Sdk.Windows\35.0.0-rc.1.80\tools\Xamarin.Android.Common.targets(1415,3): error XALNS7019:    at Xamarin.Android.Tasks.LinkAssembliesNoShrink.CopyIfChanged(ITaskItem source, ITaskItem destination) in /Users/runner/work/1/s/xamarin-android/src/Xamarin.Android.Build.Tasks/Tasks/LinkAssembliesNoShrink.cs:line 161
1>C:\Program Files\dotnet\packs\Microsoft.Android.Sdk.Windows\35.0.0-rc.1.80\tools\Xamarin.Android.Common.targets(1415,3): error XALNS7019:    at Xamarin.Android.Tasks.LinkAssembliesNoShrink.RunTask() in /Users/runner/work/1/s/xamarin-android/src/Xamarin.Android.Build.Tasks/Tasks/LinkAssembliesNoShrink.cs:line 76
1>C:\Program Files\dotnet\packs\Microsoft.Android.Sdk.Windows\35.0.0-rc.1.80\tools\Xamarin.Android.Common.targets(1415,3): error XALNS7019:    at Microsoft.Android.Build.Tasks.AndroidTask.Execute() in /Users/runner/work/1/s/xamarin-android/external/xamarin-android-tools/src/Microsoft.Android.Build.BaseTasks/AndroidTask.cs:line 25

I using in project global.json:

{
  "sdk": {
    "version": "9.0.100-rc.1.24452.12",
    "rollForward": "latestPatch"
  }
}

Original Comments

Feedback Bot on 10/4/2024, 01:14 AM:

We have directed your feedback to the appropriate engineering team for further evaluation. The team will review the feedback and notify you about the next steps.

Samantha Houts [MSFT] on 10/14/2024, 00:46 PM:

Sometimes we see this when the path is too long. If you move your project to a shorter path, does it build? Does this happen with every project or just this one? Does it happen every build? Thanks!

Why do we ask for more info?
We try to reproduce all issues reported with the information provided in the description and comments. When we can’t reproduce the issue, we ask you for more information so we can resolve the issue as quickly and efficiently as possible.
In our guidelines, you can get tips on how to provide clear and simple reproducible steps.

Kopernik Mikolaj on 10/18/2024, 00:44 AM:

(private comment, text removed)

samhouts commented 1 month ago

@dellis1972 maybe another thing to be resolved by https://github.com/dotnet/android/pull/9423?

dellis1972 commented 1 month ago

Possibly yes :D

dellis1972 commented 1 month ago

More likely resolved by https://github.com/dotnet/android-tools/pull/245 and https://github.com/dotnet/android/pull/9423

jonpryor commented 1 week ago

Please try again with .NET 9 GA. The various fixes to try to improve this scenario (be53aed593ffc3863d3df1114d97d2b5e1d6239f, others) are only in .NET 9 GA.