Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
vsfeedback opened this issue Oct 18, 2024 · 9 comments
Closed

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

vsfeedback opened this issue Oct 18, 2024 · 9 comments
Assignees
Labels
Area: App+Library Build Issues when building Library projects or Application projects.

Comments

@vsfeedback
Copy link

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)

@dotnet-policy-service dotnet-policy-service bot added the needs-triage Issues that need to be assigned. label Oct 18, 2024
@samhouts
Copy link
Member

@dellis1972 maybe another thing to be resolved by #9423?

@dellis1972
Copy link
Contributor

Possibly yes :D

@dellis1972
Copy link
Contributor

More likely resolved by dotnet/android-tools#245 and #9423

@jpobst jpobst added Area: App+Library Build Issues when building Library projects or Application projects. and removed needs-triage Issues that need to be assigned. labels Oct 18, 2024
@jonpryor
Copy link
Member

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

@eerojaaskelainen
Copy link

eerojaaskelainen commented Dec 4, 2024

Issue seems to exist in latest .NET 9 version also. If it matters, mine is a multi-project app (migrated from Xamarin.Forms).

Versions:

  • Visual Studio: 17.12.3
  • .NET: 9.0.101
  • MAUI: 9.0.10

Initial builds work OK, but rebuild fails.

Build output:

2>Done building project "MyApp.Droid.csproj".
2>C:\Program Files\dotnet\packs\Microsoft.Android.Sdk.Windows\35.0.7\tools\Xamarin.Android.Common.targets(1420,3): error XALNS7019: System.UnauthorizedAccessException: Access to the path 'C:\Temp\MyApp\obj\Debug\net9.0-android\android\assets\x86_64\MyApp.Droid.dll' is denied.
2>C:\Program Files\dotnet\packs\Microsoft.Android.Sdk.Windows\35.0.7\tools\Xamarin.Android.Common.targets(1420,3): error XALNS7019:    at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
2>C:\Program Files\dotnet\packs\Microsoft.Android.Sdk.Windows\35.0.7\tools\Xamarin.Android.Common.targets(1420,3): error XALNS7019:    at System.IO.File.InternalDelete(String path, Boolean checkHost)
2>C:\Program Files\dotnet\packs\Microsoft.Android.Sdk.Windows\35.0.7\tools\Xamarin.Android.Common.targets(1420,3): error XALNS7019:    at Microsoft.Android.Build.Tasks.Files.CopyIfChangedOnce(String source, String destination) in /Users/runner/work/1/s/xamarin-android/external/xamarin-android-tools/src/Microsoft.Android.Build.BaseTasks/Files.cs:line 197
2>C:\Program Files\dotnet\packs\Microsoft.Android.Sdk.Windows\35.0.7\tools\Xamarin.Android.Common.targets(1420,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 176
2>C:\Program Files\dotnet\packs\Microsoft.Android.Sdk.Windows\35.0.7\tools\Xamarin.Android.Common.targets(1420,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 394
2>C:\Program Files\dotnet\packs\Microsoft.Android.Sdk.Windows\35.0.7\tools\Xamarin.Android.Common.targets(1420,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
2>C:\Program Files\dotnet\packs\Microsoft.Android.Sdk.Windows\35.0.7\tools\Xamarin.Android.Common.targets(1420,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
2>C:\Program Files\dotnet\packs\Microsoft.Android.Sdk.Windows\35.0.7\tools\Xamarin.Android.Common.targets(1420,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

Edit:
Upon further investigation, it seems that msbuild.exe ("C:\Program Files\Microsoft Visual Studio\2022\Professional\MSBuild\Current\Bin\amd64\MSBuild.exe" /nologo /nodemode:1 /nodeReuse:true /low:false) is locking the file. After killing that process, rebuild works.

@FM1973
Copy link

FM1973 commented Dec 5, 2024

I got the same problem and it is really annoying.
I currently use "taskkill /IM "msbuild.exe" /F" but this is just a workaround...

@rogue-pogue
Copy link

Same problem

@tranb3r
Copy link

tranb3r commented Dec 6, 2024

Same problem.
@jonpryor Why is this issue closed? Has it been fixed? In which release?

@dellis1972
Copy link
Contributor

There were a couple of fixes in this area. The commit be53aed might well have been related. And GitHub Auto closed this Issue when that PR was merged.

That said is it more accurate that PR #9531 fixes this issue. This has been cherry-picked to the .net 9 release branch via 974a5ab. I'm not sure when that is being released though. @jonpryor any ideas when that commit will actually make it into a release?

If anyone is seeing this on the 17.12.3 please get us binlogs of the issue (with the error in it) as it will give us some pointers as to what is going on .

That said We should move the conversation over to #9133 which I will re-open as it has more up to date information,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: App+Library Build Issues when building Library projects or Application projects.
Projects
None yet
Development

No branches or pull requests

9 participants