aspnetcore
aspnetcore copied to clipboard
Wasm for updated nuget reference not updated on build
Is there an existing issue for this?
- [x] I have searched the existing issues
Describe the bug
Steps:
- Create "Blazor Web Assembly Standalone App" via new project template.
- Add a reference to the csproj file
<PackageReference Include="MudBlazor" Version="8.0.0" /> - 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";
}
}
- Build and run. The version number 8.0.0 will output as expected.
- Change the csproj reference to
<PackageReference Include="MudBlazor" Version="8.6.0" /> - Build and run. The version number being output is still 8.0.0 the wasm for the latest version was not loaded.
- Browser cache clears dont help.
- 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 thanks for contacting us.
Does removing the bin and obj folders address the issue?
/cc: @maraf
Yes, deleting bin and obj folders and then building causes the latest version to be used.
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.
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.