dotnet / aspnetcore

ASP.NET Core is a cross-platform .NET framework for building modern cloud-based web applications on Windows, Mac, or Linux.
https://asp.net
MIT License
35.04k stars 9.89k forks source link

Publish failure for a standalone WASM app #52673

Open MarkStega opened 8 months ago

MarkStega commented 8 months ago

Is there an existing issue for this?

Describe the bug

I have a WASM app that fails to publish after I added TypeScript/Javascript source to one of the razor class libraries that compose the app. To make matters worse the publish step is deleting input files from the RCL source.

Expected Behavior

I'd expect to be able to add content files to the RCL without breaking the WASM publish.

Steps To Reproduce

This is a fully reproducible problem and even though the repository is large, I can walk through the needed steps for reproduction with a minimal understanding of the repository required.

The public, open source repository is https://github.com/Material-Blazor/Material.Blazor.

1) Clone the repository 2) Checkout the vNext branch 3) Publish the Material.Blazor.Website.WebAssembly.MD3 project using the FolderProfile 4) This succeeds 5) Edit the Material.Blazor.Website.MD3.csproj 6) Delete the comment markers on lines 101, 85, 83, and 79. This enable production of two javascript assets 7) Repeat the publish step 3 above

This has two unfortunate results.

The first is that there are five files not found. They are static assets in the wwwroot folder of the Material.Blazor.Website.MD3 project. The errors are below.

The second is that those static assets are deleted from the source tree.

Connecting to C:\Solutions\OHI\Material.Blazor\.artifacts\publish\Material.Blazor.Website.WebAssembly.MD3\webassembly_net8.0\...
C:\Program Files\dotnet\sdk\8.0.100\Sdks\Microsoft.NET.Sdk.StaticWebAssets\targets\Microsoft.NET.Sdk.StaticWebAssets.Publish.targets(150,5): Error MSB3030: Could not copy the file "C:\Solutions\OHI\Material.Blazor\Material.Blazor.Website.MD3\wwwroot\icons\favicon-16x16.png" because it was not found.
C:\Program Files\dotnet\sdk\8.0.100\Sdks\Microsoft.NET.Sdk.StaticWebAssets\targets\Microsoft.NET.Sdk.StaticWebAssets.Publish.targets(150,5): Error MSB3030: Could not copy the file "C:\Solutions\OHI\Material.Blazor\Material.Blazor.Website.MD3\wwwroot\icons\favicon-32x32.png" because it was not found.
C:\Program Files\dotnet\sdk\8.0.100\Sdks\Microsoft.NET.Sdk.StaticWebAssets\targets\Microsoft.NET.Sdk.StaticWebAssets.Publish.targets(150,5): Error MSB3030: Could not copy the file "C:\Solutions\OHI\Material.Blazor\Material.Blazor.Website.MD3\wwwroot\icons\icon-512.png" because it was not found.
C:\Program Files\dotnet\sdk\8.0.100\Sdks\Microsoft.NET.Sdk.StaticWebAssets\targets\Microsoft.NET.Sdk.StaticWebAssets.Publish.targets(150,5): Error MSB3030: Could not copy the file "C:\Solutions\OHI\Material.Blazor\Material.Blazor.Website.MD3\wwwroot\images\book-shelves.jpg" because it was not found.
C:\Program Files\dotnet\sdk\8.0.100\Sdks\Microsoft.NET.Sdk.StaticWebAssets\targets\Microsoft.NET.Sdk.StaticWebAssets.Publish.targets(150,5): Error MSB3030: Could not copy the file "C:\Solutions\OHI\Material.Blazor\Material.Blazor.Website.MD3\wwwroot\images\mac.jpg" because it was not found.

Exceptions (if any)

No response

.NET Version

8.0.100

Anything else?

Microsoft Visual Studio Community 2022 (64-bit) - Preview Version 17.9.0 Preview 1.1


.NET SDK:
 Version:           8.0.100
 Commit:            57efcf1350
 Workload version:  8.0.100-manifests.71b9f198

Runtime Environment:
 OS Name:     Windows
 OS Version:  10.0.19045
 OS Platform: Windows
 RID:         win-x64
 Base Path:   C:\Program Files\dotnet\sdk\8.0.100\

.NET workloads installed:
 Workload version: 8.0.100-manifests.71b9f198
 [wasm-tools]
   Installation Source: SDK 8.0.100
   Manifest Version:    8.0.0/8.0.100
   Manifest Path:       C:\Program Files\dotnet\sdk-manifests\8.0.100\microsoft.net.workload.mono.toolchain.current\8.0.0\WorkloadManifest.json
   Install Type:              Msi

Host:
  Version:      8.0.0
  Architecture: x64
  Commit:       5535e31a71

.NET SDKs installed:
  6.0.417 [C:\Program Files\dotnet\sdk]
  7.0.401 [C:\Program Files\dotnet\sdk]
  8.0.100 [C:\Program Files\dotnet\sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.App 6.0.25 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 7.0.14 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 8.0.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 6.0.25 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 7.0.14 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 8.0.0 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.WindowsDesktop.App 6.0.25 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 7.0.14 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 8.0.0 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

Other architectures found:
  x86   [C:\Program Files (x86)\dotnet]
    registered at [HKLM\SOFTWARE\dotnet\Setup\InstalledVersions\x86\InstallLocation]

Environment variables:
  Not set

global.json file:
  Not found

Learn more:
  https://aka.ms/dotnet/info

Download .NET:
  https://aka.ms/dotnet/download

C:\Users\ms>
javiercn commented 8 months ago

@MarkStega thanks for contacting us.

Try adding ~<AccelerateBuildsInVisualStudio>true</AccelerateBuildsInVisualStudio>~ to https://github.com/Material-Blazor/Material.Blazor/blob/main/Directory.Build.props to see if that fixes your issue.

Does it work if you do the build/publish step from the command line?

UPDATE

Please set the <AccelerateBuildsInVisualStudio>**false**</AccelerateBuildsInVisualStudio> instead. The above was unintentional / typo.

ghost commented 8 months ago

Hi @MarkStega. We have added the "Needs: Author Feedback" label to this issue, which indicates that we have an open question for you before we can take further action. This issue will be closed automatically in 7 days if we do not hear back from you by then - please feel free to re-open it if you come back to this issue after that time.

MarkStega commented 8 months ago

@javiercn

On the desktop in Visual Studio, the 'accelerate' addition makes no difference; The source files in the images & icons directory of Material.Blazor.Website.MD3 get deleted and then the publish fails.

The same behavior occurs with a command line 'dotnet publish'.

I originally saw the behavior on the workflow run in the github repository. https://github.com/Material-Blazor/Material.Blazor/actions/runs/7182566364/job/19559534765

What I find odd is that the almost identical projects in the repository build and publish with no issue.

RCL's of Material.Blazor & Material.Blazor.Website comprise the content of Material.Blazor.Website.Webassembly

in the same fashion as

RCL's of Material.Blazor.MD3 & Material.Blazor.Website.MD3 comprise the content of Material.Blazor.Website.Webassembly.MD3

but the build and publish of the 'non MD3' version succeeds.

MarkStega commented 8 months ago

@javiercn

You actually helped me with the csproj for the resource build in 35274

MarkStega commented 6 months ago

@javiercn

Now that it appears that #38445 is unlikely to be implemented, is there documentation on the 'preferred' way to build 3rd party assets using csproj commands?

mkArtakMSFT commented 6 months ago

@MarkStega I've updated @javiercn's comment above as he meant to recommend you to try to disable the accelerated build in VS. Can you please try that again and see if that makes a difference: https://github.com/dotnet/aspnetcore/issues/52673#issuecomment-1850608468

ghost commented 6 months ago

Hi @MarkStega. We have added the "Needs: Author Feedback" label to this issue, which indicates that we have an open question for you before we can take further action. This issue will be closed automatically in 7 days if we do not hear back from you by then - please feel free to re-open it if you come back to this issue after that time.

MarkStega commented 6 months ago

With AccelerateBuildsInVisualStudio set to true or false the same error occurs.

I don't think we can point to Visual Studio as the problem. The issue was first seen on a github actions CLI build. I was able to reproduce in VS which was more convenient than setting up a CLI build process on my development system.