Anagh Goswami
Anagh Goswami

Reputation: 68

Could not load assembly, DLL missing in bin/release/net6.0/bin

I am trying to test a .NET 6 function app on azure but I am consistently getting "Could not load xyz assembly" error during runtime.

I saw that the assembly is present in bin/release/net6.0 but not in bin/release/net6.0/bin which I think is causing the issue.

I have added this to the csproj file as well - I saw that the assembly is present in bin/release/net6.0 but not in bin/release/net6.0/bin which I think is causing the issue.

I have added this to the csproj file as well -

<PropertyGroup>
    <CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
</PropertyGroup>

I am using visual studio 2022.

Is there any way of having all the DLLs in bin/release/net6.0/bin folder? Any MS Build arguments which might help? I am trying to avoid a script for this.

Upvotes: 0

Views: 301

Answers (1)

Pravallika KV
Pravallika KV

Reputation: 8694

As @Sean Skelly mentioned, the package DLL's will be available in bin/Debug/.net 6.0.

I have created a simple Http Azure function and all the DLL's are available in the bin/Debug/.net 6.0 as shown below: enter image description here

getting "Could not load xyz assembly" error during runtime.

  • This happens if any of the the dependency is missing or cannot be loaded in the application.
  • Check if the package is included in the project and also installed on the machine where the application is running.
  • It also happens mostly when the package version is incorrect or incompatible with the application.
  • Try downgrade or upgrading the package version which is compatible to the application.

I tried using an assembly which version is not compatible with my project (.net 6.0)

enter image description here

and I was getting the same error.

enter image description here

Later, I degraded the package version and it worked.

enter image description here

enter image description here

Upvotes: 0

Related Questions