Unable to copy file "libman.json" building MAUI, BLazor IOS app

Dan Taxbøl 20 Reputation points
2024-10-07T13:12:31.76+00:00

I am trying to build a MAUI Blazor project for iOS. The Windows and Android builds work fine. I have upgraded to SDK 8.0.402.1 for both the SDK and workload to ensure compatibility with iOS 18 and Xcode 16. However, I am encountering the following error and cannot figure out where it is coming from:

Unable to copy file "libman.json" to "c:\Temp\U\Xamarin\HotRestart\Bundles\1.1.7.0\06bfa05d\DrivePerspective.Mobile.app\D:\Gitrepo\DrivePerspective\DrivePerspective.Mobile\libman.json" dotnet --version

8.0.402 dotnet sdk check

.NET SDKs:

Version      Status                    


7.0.410      .NET 7.0 is out of support.

8.0.400      Patch 8.0.402 is available.

8.0.402      Up to date.               

 

Try out the newest .NET SDK features with .NET 9.0.100-rc.1.24452.12.

 

dotnet workload list

 

Workload version: 8.0.402.1

Thanks

Blazor
Blazor
A free and open-source web framework that enables developers to create web apps using C# and HTML being developed by Microsoft.
1,584 questions
.NET MAUI
.NET MAUI
A Microsoft open-source framework for building native device applications spanning mobile, tablet, and desktop.
3,540 questions
{count} votes

Accepted answer
  1. Wenyan Zhang (Shanghai Wicresoft Co,.Ltd.) 31,976 Reputation points Microsoft Vendor
    2024-10-09T02:30:18.9166667+00:00

    Hello,

    Please add the following in .csproj file:

     <Target Name="_LibraryManagerRestoreContentItems" AfterTargets="LibraryManagerRestore">
        <ItemGroup>
          <Content Remove="@(FilesForPackagingFromProject)" />
          <Content Include="@(FilesForPackagingFromProject)" CopyToPublishDirectory="PreserveNewest" />
        </ItemGroup>
      </Target>
    

    it seems the only option now is to wait for VS 17.11.5, right?

    There is a known issue- [Blazor] libman libraries not included in first build · Issue #680 · aspnet/LibraryManager (github.com), please follow the progress, and you could post comments to let them know your concerns.

    Best Regards,

    Wenyan Zhang


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.