unoplatform / Uno.Wasm.Bootstrap

A simple nuget package to run C# code in a WASM-compatible browser
Other
367 stars 57 forks source link

Can't build WASM project duo to read-only asset files #814

Closed jeromelaban closed 8 months ago

jeromelaban commented 8 months ago

Discussed in https://github.com/unoplatform/Uno.Wasm.Bootstrap/discussions/813

Originally posted by **VRage** January 9, 2024 We are using Perforce as our revision management tool, which makes all submitted files read-only. Normally, it is not a big deal, but building a Uno WebAssembly (Wasm) project fails: Uno.Wasm.Bootstrap.targets(207,3): error : System.UnauthorizedAccessException: Access to the path 'back.svg' is denied. Other files are affected as well: .Wasm/libman.json .Wasm/wwwroot/staticwebapp.config.json Wasm/wwwroot/web.config /Assets/Icons/*.svg /Assets/Icons/SharedAssets.md It seems that during the build, the Uno WebAssembly Bootstrap copies all the files with the read-only property enabled. Subsequent builds attempt to overwrite those read-only files, leading to this error. If I manually remove the read-only property on those files in the bin/obj folder, the next build will be successful. This problem does not occur when building the Windows project. Turning off the read-only property on every Perforce client is not an option.
jeromelaban commented 8 months ago

Thanks @vrage for the report. Could you create a binlog out of a test build for a solution which is under perforce?

VRage commented 8 months ago

Hi @jeromelaban sure. There you go msbuild.txt I've changed filetype from .binlog to .txt

jeromelaban commented 8 months ago

@VRage We've implemented some changes for this in https://github.com/unoplatform/Uno.Wasm.Bootstrap/pull/815. Could you try with the nuget packages in this build, in the uno-wasm-bootstrap-drop artifact.

You'll need to create a "local nuget" feed, and install the packages from there.

Let me know if this helps for you, thanks!

VRage commented 8 months ago

@jeromelaban i could not install the uno.wasm.versionchecker nuget:

Install-Package : NU1202: Package Uno.Wasm.VersionChecker 0.2.0-PullRequest0815.1508 is not compatible with net7.0 (.NETCoreApp,Version=v7.0). Package Uno.Wasm.VersionChecker 0.2.0-PullRequest0815.1508 supports:
  - net5.0 (.NETCoreApp,Version=v5.0) / any
  - net7.0 (.NETCoreApp,Version=v7.0) / any
At line:1 char:1
+ Install-Package "D:\Temp\CloudViewer_Projects\New folder\Uno.Wasm.Ver ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Install-Package], Exception
    + FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PackageManagement.PowerShellCmdlets.InstallPackageCommand

Install-Package : NU1212: Invalid project-package combination for Uno.Wasm.VersionChecker 0.2.0-PullRequest0815.1508. DotnetToolReference project style can only contain references of the DotnetTool type 
At line:1 char:1
+ Install-Package "D:\Temp\CloudViewer_Projects\New folder\Uno.Wasm.Ver ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Install-Package], Exception
    + FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PackageManagement.PowerShellCmdlets.InstallPackageCommand

Install-Package : Package 'Uno.Wasm.VersionChecker 0.2.0-PullRequest0815.1508' has a package type 'DotnetTool' that is not supported by project 'Source\Platforms\PerforceUnoReadOnlyFiles.Wasm'.
At line:1 char:1
+ Install-Package "D:\Temp\CloudViewer_Projects\New folder\Uno.Wasm.Ver ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Install-Package], Exception
    + FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PackageManagement.PowerShellCmdlets.InstallPackageCommand

If i try to build i get following errors:

1>C:\Users\Jakob\.nuget\packages\uno.wasm.bootstrap\0.2.0-pullrequest0815.1508\build\Uno.Wasm.Bootstrap.targets(207,3): error : [00:00:00.9554498] Unhandled exception. System.Exception: Could not resolve Microsoft.Extensions.Hosting.Abstractions
1>C:\Users\Jakob\.nuget\packages\uno.wasm.bootstrap\0.2.0-pullrequest0815.1508\build\Uno.Wasm.Bootstrap.targets(207,3): error : [00:00:00.9555898]    at Driver.Resolve(String asm_name, AssemblyKind& kind) in /_/src/Uno.Wasm.Packager/packager.cs:line 247
1>C:\Users\Jakob\.nuget\packages\uno.wasm.bootstrap\0.2.0-pullrequest0815.1508\build\Uno.Wasm.Bootstrap.targets(207,3): error : [00:00:00.9556147]    at Driver.Import(String ra, AssemblyKind kind) in /_/src/Uno.Wasm.Packager/packager.cs:line 318
1>C:\Users\Jakob\.nuget\packages\uno.wasm.bootstrap\0.2.0-pullrequest0815.1508\build\Uno.Wasm.Bootstrap.targets(207,3): error : [00:00:00.9556172]    at Driver.Import(String ra, AssemblyKind kind) in /_/src/Uno.Wasm.Packager/packager.cs:line 318
1>C:\Users\Jakob\.nuget\packages\uno.wasm.bootstrap\0.2.0-pullrequest0815.1508\build\Uno.Wasm.Bootstrap.targets(207,3): error : [00:00:00.9556194]    at Driver.Run(String[] args) in /_/src/Uno.Wasm.Packager/packager.cs:line 785
1>C:\Users\Jakob\.nuget\packages\uno.wasm.bootstrap\0.2.0-pullrequest0815.1508\build\Uno.Wasm.Bootstrap.targets(207,3): error : [00:00:00.9556708]    at Driver.Main(String[] args) in /_/src/Uno.Wasm.Packager/packager.cs:line 412
1>C:\Users\Jakob\.nuget\packages\uno.wasm.bootstrap\0.2.0-pullrequest0815.1508\build\Uno.Wasm.Bootstrap.targets(207,3): error : System.Exception: Failed to generate wasm layout (More details are available in diagnostics mode or using the MSBuild /bl switch)
1>C:\Users\Jakob\.nuget\packages\uno.wasm.bootstrap\0.2.0-pullrequest0815.1508\build\Uno.Wasm.Bootstrap.targets(207,3): error :    at Uno.Wasm.Bootstrap.ShellTask_v690c40a1308514abfaaaba256e9cdecea218fd96.RunPackager() in /_/src/Uno.Wasm.Bootstrap/ShellTask.cs:line 768
1>C:\Users\Jakob\.nuget\packages\uno.wasm.bootstrap\0.2.0-pullrequest0815.1508\build\Uno.Wasm.Bootstrap.targets(207,3): error :    at Uno.Wasm.Bootstrap.ShellTask_v690c40a1308514abfaaaba256e9cdecea218fd96.Execute() in /_/src/Uno.Wasm.Bootstrap/ShellTask.cs:line 271

image

jeromelaban commented 8 months ago

Thanks. It's expected that the Uno.Wasm.VersionChecker cannot be installed, it's a command line tool, not a library package.

For the Microsoft.Extensions.Hosting.Abstractions issue, this looks different and let's move to a discussion as it's unrelated to the readonly attribute.

jeromelaban commented 8 months ago

A new build of the uno.wasm.bootstrap packages will be available soon in the 8.0.x branch.

jeromelaban commented 8 months ago

It is now available as part of Uno.Wasm.Bootstrap 8.0.7.