Skip to content

[wasm] VFS/common WasmApp properties ignored in wasmbrowser template #99223

@RedMike

Description

@RedMike

Description

There are a number of public properties listed in WasmApp.Common.targets (previously WasmApp.targets) like WasmFilesToIncludeInFileSystem. However, at least in 8.0.2, the logic does not run even for a fresh project from wasmbrowser template. This seems to be because some properties/items are tied to WasmGenerateAppBundle being true (which leads to _WasmGenerateAppBundle running), but that is forced to false when _UsingBlazorOrWasmSdk is true within the toolchain.

This means that there's no actual AppBundle folder created, VFS isn't exposed at all so there's no apparent way to add files to it, and some other properties listed in the targets file don't seem to have an effect.

Setting WasmGenerateAppBundle to true, or attempting to unset _UsingBlazorOrWasmSdk, in the csproj does not work because these values are being set in the toolchain file.

The documentation for WasmGenerateAppBundle at least seems to be wrong if this is intentional:

Defaults to true.
This is useful for projects that want to handle their own
packaging, or app bundle generation, eg. Blazor.

But then also there's no exposed way to acccess VFS and a few other features, when it would be convenient to do so.
The documentation in features.md is also wrong then, as it lists AppBundle as the folder and that is never created from the template, only wwwroot.

Reproduction Steps

  1. Install wasm-tools and wasm-experimental workloads (to have the templates, but that's not strictly required I think)
  2. Create a project from the wasmbrowser template
  3. Enable MSBuild Detailed logging
  4. Build or publish the project

Expected behavior

Target _WasmGenerateAppBundle is not skipped.

Actual behavior

Target "_WasmGenerateAppBundle" skipped, due to false condition; ('$(WasmGenerateAppBundle)' == 'true') was evaluated as ('false' == 'true').

Regression?

No response

Known Workarounds

Injecting a target that runs as part of the toolchain or at least early enough in the WASM workflow, which sets WasmGenerateAppBundle works.

For VFS specifically, I understand there might be some way to provide a custom MonoConfig in JS to set a list of assets. I haven't been able to get that working because of errors during the build, which seem to be tied to the MSBuild targets expecting WasmAppBuilder to have run (which it doesn't).

Configuration

.NET 8
Browser WASM

Other information

No response

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions