Search code examples
c#blazorblazor-webassembly

Why Blazor WASM fails to add the assembly reference?


I am getting this weird error that appears when I try to reference .NET standard library into my project.

This is a .NET 6 Blazor WASM Hosted. The full description is here:

"Severity Code Description Project File Line Suppression State Details Error MSB3954 Failed to compute hash for file 'NorwestStudentPlan.Shared' because it does not exist or is inaccessible. NorwestActivity.Client C:\Users\nconnect.nuget\packages\microsoft.net.sdk.webassembly.pack\8.0.4\build\Microsoft.NET.Sdk.WebAssembly.Browser.targets 356"

There error is only for the first reference "NorwestStudentPlan.Shared.dll" and not the second one "StudentManagementLibrary.dll".

Picture of the Error List

I have tried updating visual studio. I have also tried adding the project reference from the local bin/debug folder of the first project called "NorwestStudentPlan" and this also does not seem to work. However, when I delete all files from the build and only leave the NorwestStudenPlan.Shared.dll, it works! The entire solution builds.

The reason why it will be important to reference from the wwwroot folder is because that is the folder where we publish all the latest assembly files so that our other projects can read from.

Any input would be hugely appreciated.

Thank you.

Edit: After some search and debugging, There seems to be other files are interfering with the .dll being referenced when i publish the solution. For example, When I delete "DocumentFormat.OpenXml.dll" from the folder and build my solution referencing the NorwestStudenPlan.Shared.dll, it works great. Any idea what is going on here?

DocumentFormat.OpenXml.dll


Solution

  • Thanks for the input guys. I Followed Cristian Rusanu's comment above, and went on to match all the versions of the nuget packages and also added the ones that the .dll of interest had including "Microsoft.IdentityModel.Tokens" and "DocumentFormat.OpenXml". This worked! seems to be that referencing a .dll in another project that uses nuget packages not found in the other project, will not work despite these .dll files existing and are within the published project I want to reference the desired .dll from. I Need to make sure that these are added on the project I want to bring in a .dll to.