.NET 8.0 Upgrade Causes Blazor Hybrid in WinForms to Seek wwwroot Files in Dev Path After ClickOnce Publish

250 views Asked by At

I've encountered an issue with a Blazor Hybrid application, which is hosted in a Windows Forms form. This problem surfaced after I upgraded my project to .NET 8.0. Specifically, the ClickOnce published version of the application is incorrectly trying to access static files from the wwwroot directory in my development environment's output path, rather than using the files within the published package.

Background:

  • Original State: Prior to the upgrade, the application was functioning correctly with the previous .NET version.
  • Upgrade Process: I upgraded to .NET 8.0 first by updating Visual Studio 2022, then retargeting my .csproj as well as the ClickOnce profile to .NET 8 and finally, updated to the latest NuGet packages.
  • Issue: Post-upgrade, when I publish the application using ClickOnce and run it, it seems to be looking for the static files (like CSS, JS, etc.) in the wwwroot folder from a static path on my development machine.

Observations: enter image description here

  • The issue only occurs in the ClickOnce published version running on a user's machne. In the development environment, everything works as expected because the paths do exist.
  • No relevant changes were made to the project configuration or file paths in the process of upgrading.
  • The application's behavior was normal and as expected before the .NET 8.0 upgrade.

Attempts to Resolve:

  • I've checked the publish profiles and project configuration for any path-specific settings that might have been altered during the upgrade.
  • Ensured that the wwwroot folder is included in the ClickOnce publish settings.
  • Searched for similar issues but didn't find any specifically related to the .NET 8.0 upgrade and Blazor Hybrid applications.

Questions:

  1. Has anyone experienced a similar issue with Blazor Hybrid applications in .NET 8.0, particularly when using ClickOnce for publishing?
  2. Are there any known changes in .NET 8.0 that could affect how ClickOnce handles the wwwroot folder or static file paths in general?
  3. What are some potential solutions or troubleshooting steps I can take to resolve this path issue?

Any insights or suggestions would be greatly appreciated. Thank you in advance for your help!

1

There are 1 answers

0
DAGUE Benjamin On

As said previously, the issue is under investigation.

The issue comme from a specific json file added to click once published process since VS 17.8.0. As a workaround, you can just delete at runtime the file ApplicationName.staticwebassets.runtime.json located in your app directory.