dotnet / runtime

.NET is a cross-platform runtime for cloud, mobile, desktop, and IoT apps.
https://docs.microsoft.com/dotnet/core/
MIT License
14.84k stars 4.62k forks source link

[browser] Publish `wasmbrowser` app from Visual Studio doesn't respect "include RID in output path" #99159

Open maraf opened 5 months ago

maraf commented 5 months ago
  1. Install WebAssembly Browser App template via command: dotnet workload install wasm-experimental
  2. Create a new WebAssembly Browser App via Visual studio.
  3. Publish the project to folder.

image

Output is located in bin/Release/net8.0/publish instead of bin/Release/net8.0/browser-wasm/publish

The same setup works for blazorwasm template

ghost commented 5 months ago

Tagging subscribers to 'arch-wasm': @lewing See info in area-owners.md if you want to be subscribed.

Issue Details
1. Install WebAssembly Browser App template via command: dotnet workload install wasm-experimental 1. Create a new WebAssembly Browser App via Visual studio. 1. Publish the project to folder. ![image](https://github.com/dotnet/runtime/assets/10020471/0ab8c2bd-e8a5-4c1e-bfcf-e0a83c1ba4fd) Output is located in `bin/Release/net8.0/publish` instead of `bin/Release/net8.0/browser-wasm/publish`
Author: maraf
Assignees: maraf
Labels: `arch-wasm`, `area-Build-mono`, `os-browser`
Milestone: 9.0.0
JakeYallop commented 5 months ago

This might also be related to https://github.com/dotnet/runtime/issues/94319

maraf commented 5 months ago

This might also be related to #94319

It is a different issue, because it uses completely different SDK under the hood (the plan is to migrate to the SDK used by wasmbrowser)

maraf commented 5 months ago

The issue is this workaround https://github.com/dotnet/runtime/blob/43b55faf1586242c990051c01f8e13e6dfd0813f/src/mono/nuget/Microsoft.NET.Sdk.WebAssembly.Pack/build/Microsoft.NET.Sdk.WebAssembly.Browser.targets#L198-L199

I'm not sure yet why I see it working for Blazor SDK correctly (maybe I oversaw it doesn't?)

The FolderPublish.pubxml is different

WasmBrowser

<?xml version="1.0" encoding="utf-8"?>
<!--
https://go.microsoft.com/fwlink/?LinkID=208121.
-->
<Project>
  <PropertyGroup>
    <Configuration>Release</Configuration>
    <Platform>Any CPU</Platform>
    <PublishDir>bin\Release\net9.0\browser-wasm\publish\</PublishDir>
    <PublishProtocol>FileSystem</PublishProtocol>
    <_TargetId>Folder</_TargetId>
  </PropertyGroup>
</Project>

Blazor

<?xml version="1.0" encoding="utf-8"?>
<!--
https://go.microsoft.com/fwlink/?LinkID=208121.
-->
<Project>
  <PropertyGroup>
    <DeleteExistingFiles>false</DeleteExistingFiles>
    <ExcludeApp_Data>false</ExcludeApp_Data>
    <LaunchSiteAfterPublish>true</LaunchSiteAfterPublish>
    <LastUsedBuildConfiguration>Release</LastUsedBuildConfiguration>
    <LastUsedPlatform>Any CPU</LastUsedPlatform>
    <PublishProvider>FileSystem</PublishProvider>
    <PublishUrl>bin\Release\net9.0\browser-wasm\publish\</PublishUrl>
    <WebPublishMethod>FileSystem</WebPublishMethod>
    <_TargetId>Folder</_TargetId>
  </PropertyGroup>
</Project>

Which might be related to project capabilities

maraf commented 4 months ago

In recent testing it seems that publish from VS dialog doesn't do publish at all. I'm seeing running a Build target.