aspnetcore icon indicating copy to clipboard operation
aspnetcore copied to clipboard

Wasm for updated nuget reference not updated on build

Open innominateAtWork opened this issue 6 months ago • 3 comments

Is there an existing issue for this?

  • [x] I have searched the existing issues

Describe the bug

Steps:

  1. Create "Blazor Web Assembly Standalone App" via new project template.
  2. Add a reference to the csproj file <PackageReference Include="MudBlazor" Version="8.0.0" />
  3. Add code in Home.razor to output the version number
Mud Blazor Version: @GetVersion()

@code {
    public static string? GetVersion()
    {
        var assembly = typeof(MudBlazor.MudButton).Assembly;
        var infoVer = assembly.GetCustomAttributes(typeof(AssemblyInformationalVersionAttribute), false).OfType<AssemblyInformationalVersionAttribute>().FirstOrDefault();
        return infoVer?.InformationalVersion ?? "Unknown";
    }
}
  1. Build and run. The version number 8.0.0 will output as expected.
  2. Change the csproj reference to <PackageReference Include="MudBlazor" Version="8.6.0" />
  3. Build and run. The version number being output is still 8.0.0 the wasm for the latest version was not loaded.
  4. Browser cache clears dont help.
  5. In order to get the latest version a ReBuild is required.

I followed steps 1-6 and put the files (including bin / obj) into a zip here: https://github.com/innominateAtWork/BlazorOldWasmBuildIssue

I can see that doing a build does not update the file "\BlazorApp1\bin\Debug\net8.0\wwwroot_framework\MudBlazor.wasm" while doing a rebuild does.

Expected Behavior

A build should cause the latest code from assemblies referenced via nuget to be included

Steps To Reproduce

No response

Exceptions (if any)

No response

.NET Version

No response

Anything else?

No response

innominateAtWork avatar May 20 '25 20:05 innominateAtWork

@innominateAtWork thanks for contacting us.

Does removing the bin and obj folders address the issue?

/cc: @maraf

javiercn avatar May 21 '25 08:05 javiercn

Yes, deleting bin and obj folders and then building causes the latest version to be used.

innominateAtWork avatar May 21 '25 13:05 innominateAtWork

I've encountered the same issue. After updating the dependency versions of third-party libraries, the old versions are still being used (e.g., JS). In severe cases, the project fails to run. The only solution is to manually delete the bin and obj folders and then rebuild.

capdiem avatar Jun 18 '25 13:06 capdiem

I have also had this same issue using the MudBlazor package. This was only fixed with dotnet-purge as the build kept using the outdated files.

See https://github.com/MudBlazor/MudBlazor/issues/11683

KieranFoot avatar Aug 11 '25 09:08 KieranFoot