Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setting RuntimeFrameworkVersion of Blazor project and building with .net 9 SDK installed fails to create blazor.boot.json file #59069

Open
1 task done
pingu2k4 opened this issue Nov 20, 2024 · 0 comments
Labels
area-infrastructure Includes: MSBuild projects/targets, build scripts, CI, Installers and shared framework

Comments

@pingu2k4
Copy link

Is there an existing issue for this?

  • I have searched the existing issues

Describe the bug

Hey, so have been on a bit of discovery with this. I recently installed the latest VS update, coincidentally getting the .net 9 SDK.

WE have a Blazor wasm standalone application, using .net 8. Due to a seperate issue related to our build pipeline, we added the following line to our .csproj a couple months ago: <RuntimeFrameworkVersion>8.0.7</RuntimeFrameworkVersion> (The issue was with 8.0.10).

It appears that this one line is the root cause of all our issues.
Anyway, when I first attempted to build the project after having updated VS / got the .net 9 SDK, I could no longer build the project. The error I receive was:

C:\Program Files\dotnet\sdk\9.0.100\Sdks\Microsoft.NET.Sdk.StaticWebAssets\targets\Microsoft.NET.Sdk.StaticWebAssets.Compression.targets(241,5): error MSB4018:
      The "ApplyCompressionNegotiation" task failed unexpectedly.
      System.InvalidOperationException: Endpoints not found for related asset: D:\VS\EIT.App\frontend\bin\Debug\net8.0\w
      wwroot\_framework\Blazor-ApexCharts.wasm
         at Microsoft.AspNetCore.StaticWebAssets.Tasks.ApplyCompressionNegotiation.Execute()
         at Microsoft.Build.BackEnd.TaskExecutionHost.Execute()
         at Microsoft.Build.BackEnd.TaskBuilder.ExecuteInstantiatedTask(TaskExecutionHost taskExecutionHost, TaskLogging
      Context taskLoggingContext, TaskHost taskHost, ItemBucket bucket, TaskExecutionMode howToExecuteTask)

Upon searching, I found very little. I mainly found mentioned of the same "task failed", but being triggered instead by a duplicate key issue, not the Endpoints not found issue. Its also not an issue with the nuget package it references - that just happens to be the first nuget package in the .csproj file - Coincidentally we aren't using that one currently so I had tried removing it, in which case we get the same error but pointing to the next nuget package which is installed instead.

Amongst other things, I tried a clean and rebuild. This also failed, but now the error was different:

C:\Users\pingu\.nuget\packages\microsoft.net.sdk.webassembly.pack\8.0.7\build\Microsoft.NET.Sdk.WebAssembly.Browser.targets(321,5): error :
      System.InvalidOperationException: No file exists for the asset at either location 'obj\Debug\net8.0\blazor.boot.js
      on' or 'obj\Debug\net8.0\blazor.boot.json'.
         at Microsoft.AspNetCore.StaticWebAssets.Tasks.StaticWebAsset.ComputeFingerprintAndIntegrity(String identity, St
      ring originalItemSpec)
         at Microsoft.AspNetCore.StaticWebAssets.Tasks.DefineStaticWebAssets.Execute()

I checked, and there was in fact no blazor.boot.json file being created there.

So the endpoints issue, I believe is due to the blazor.boot.json file not being created, but the file was already there so a stale, out of date file was being used instead. So the real bug, is that under this scenario the blazor.boot.json file isn't being created for some reason.

In order to fix this, our initial fix has been to create a global.json file at the repo root as:

{
    "sdk": {
      "version": "8.0.404",
      "rollForward": "latestFeature"
    }
  }

I am however going to be checking soon to see if we can use 8.0.11 as our previous build issue was with 8.0.10 and we haven't tried 8.0.11 yet, as Removing the <RuntimeFrameworkVersion>8.0.7</RuntimeFrameworkVersion> line from the .csproj also fixed the issue entirely.

Expected Behavior

Should be able to build - Should create the blazor.boot.json file

Steps To Reproduce

  • Create a new Blazor Wasm standalone project in .net 8
  • Have .net 9 SDK installed
  • Add the following line within a PropertyGroup in your .csproj file: <RuntimeFrameworkVersion>8.0.7</RuntimeFrameworkVersion>
  • Attempt to build and notice the failure

For the sake of completeness, a fresh .net 8 Blazor wasm standalone app, where the csproj file is the following:

<Project Sdk="Microsoft.NET.Sdk.BlazorWebAssembly">

  <PropertyGroup>
    <TargetFramework>net8.0</TargetFramework>
    <Nullable>enable</Nullable>
    <ImplicitUsings>enable</ImplicitUsings>
    <RuntimeFrameworkVersion>8.0.7</RuntimeFrameworkVersion>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="8.0.11" />
    <PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="8.0.11" PrivateAssets="all" />
  </ItemGroup>

</Project>

Exceptions (if any)

C:\Users\pingu\.nuget\packages\microsoft.net.sdk.webassembly.pack\8.0.7\build\Microsoft.NET.Sdk.WebAssembly.Browser.targets(321,5): error :
      System.InvalidOperationException: No file exists for the asset at either location 'obj\Debug\net8.0\blazor.boot.js
      on' or 'obj\Debug\net8.0\blazor.boot.json'.
         at Microsoft.AspNetCore.StaticWebAssets.Tasks.StaticWebAsset.ComputeFingerprintAndIntegrity(String identity, St
      ring originalItemSpec)
         at Microsoft.AspNetCore.StaticWebAssets.Tasks.DefineStaticWebAssets.Execute()

.NET Version

9.0.100

Anything else?

dotnet --info
.NET SDK:
 Version:           9.0.100
 Commit:            59db016f11
 Workload version:  9.0.100-manifests.c6f19616
 MSBuild version:   17.12.7+5b8665660

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

.NET workloads installed:
 [wasm-tools-net6]
   Installation Source: VS 17.12.35506.116
   Manifest Version:    9.0.0/9.0.100
   Manifest Path:       C:\Program Files\dotnet\sdk-manifests\9.0.100\microsoft.net.workload.mono.toolchain.net6\9.0.0\WorkloadManifest.json
   Install Type:              Msi

 [wasm-tools-net8]
   Installation Source: VS 17.12.35506.116
   Manifest Version:    9.0.0/9.0.100
   Manifest Path:       C:\Program Files\dotnet\sdk-manifests\9.0.100\microsoft.net.workload.mono.toolchain.net8\9.0.0\WorkloadManifest.json
   Install Type:              Msi

 [wasm-tools]
   Installation Source: VS 17.12.35506.116
   Manifest Version:    9.0.0/9.0.100
   Manifest Path:       C:\Program Files\dotnet\sdk-manifests\9.0.100\microsoft.net.workload.mono.toolchain.current\9.0.0\WorkloadManifest.json
   Install Type:              Msi

 [maui-windows]
   Installation Source: VS 17.12.35506.116
   Manifest Version:    9.0.0/9.0.100
   Manifest Path:       C:\Program Files\dotnet\sdk-manifests\9.0.100\microsoft.net.sdk.maui\9.0.0\WorkloadManifest.json
   Install Type:              Msi

 [maccatalyst]
   Installation Source: VS 17.12.35506.116
   Manifest Version:    18.0.9617/9.0.100
   Manifest Path:       C:\Program Files\dotnet\sdk-manifests\9.0.100\microsoft.net.sdk.maccatalyst\18.0.9617\WorkloadManifest.json
   Install Type:              Msi

 [ios]
   Installation Source: VS 17.12.35506.116
   Manifest Version:    18.0.9617/9.0.100
   Manifest Path:       C:\Program Files\dotnet\sdk-manifests\9.0.100\microsoft.net.sdk.ios\18.0.9617\WorkloadManifest.json
   Install Type:              Msi

 [android]
   Installation Source: VS 17.12.35506.116
   Manifest Version:    35.0.7/9.0.100
   Manifest Path:       C:\Program Files\dotnet\sdk-manifests\9.0.100\microsoft.net.sdk.android\35.0.7\WorkloadManifest.json
   Install Type:              Msi

Configured to use loose manifests when installing new manifests.

Host:
  Version:      9.0.0
  Architecture: x64
  Commit:       9d5a6a9aa4

.NET SDKs installed:
  6.0.321 [C:\Program Files\dotnet\sdk]
  7.0.120 [C:\Program Files\dotnet\sdk]
  8.0.206 [C:\Program Files\dotnet\sdk]
  8.0.404 [C:\Program Files\dotnet\sdk]
  9.0.100 [C:\Program Files\dotnet\sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.App 6.0.26 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 6.0.36 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 7.0.20 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 8.0.6 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 8.0.11 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.AspNetCore.App 9.0.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 6.0.26 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 6.0.36 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 7.0.20 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 8.0.6 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 8.0.11 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.NETCore.App 9.0.0 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.WindowsDesktop.App 6.0.26 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 6.0.36 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 7.0.20 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 8.0.6 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 8.0.11 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
  Microsoft.WindowsDesktop.App 9.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
@dotnet-issue-labeler dotnet-issue-labeler bot added the area-infrastructure Includes: MSBuild projects/targets, build scripts, CI, Installers and shared framework label Nov 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-infrastructure Includes: MSBuild projects/targets, build scripts, CI, Installers and shared framework
Projects
None yet
Development

No branches or pull requests

1 participant