0

I have this solution that consists of multiple projects (one is a class library and other is the web project, which is MVC. However, when trying to run the web project in Debug, I get the "Could not load file or assembly..." error.

Assembly Reference Error

I have the NuGet package references installed in the class library and the class library is referenced by the web project. So, I have no idea why this error is generating when the references are clearly included in the class library.

Class library Nuget Package References

I would like to how if anyone knows how to resolve this? It doesn't make sense to include the NuGet package in both the class library and the web application.

5
  • Possible duplicate of Could not load file or assembly or one of its dependencies Commented Apr 16, 2019 at 4:31
  • Hi Hashan, please right click the solution name and clean, delete the bin and obj folder to build. Checking if the "Copy to Local" property for the reference AWSSDK.SQS is set to true and the specific version is set to true, Right click the project name-properties-Build and platform target should be ‘Any CPU’. If this issue persists, please have a test directly add this reference under this web application, it can help us confirm the reference version is right and not the reason that caused this issue. Commented Apr 17, 2019 at 8:06
  • @SaraLiu-MSFT Thank you for your comment. I have tried your first suggestion and I cannot still resolve this issue. Therefore, I tried adding the SQS reference to the web project manually using the NuGet (same version as the class library as you mentioned). When I did this it worked. Therefore, I am a bit confused about why I need to add the package to both class library and web project. Any ideas? Commented Apr 24, 2019 at 5:19
  • @SaraLiu-MSFT Also, let me add a bit more details about this issue, so it may aid you to help me find a solution. In my current visual studio solution, I have a class library which is in .NET Standard 2.0 and it consists of the SQS .dll from Nuget. Then my web (MVC) project is based on .NET framework 4.7.1 and it references the class library. Therefore, I was wondering whether this has anything to do with it? Commented Apr 24, 2019 at 5:19
  • @HashanJXT, thanks for your update, have you directly use or invoke some features inside the AWSSDK.SQS.dll in the class library? If not, you can have a try with it, directly use this dll inside the class library will make the dll be copied into the MVC web application, please have a look at this: the stackoverflow.com/questions/1132243/… Commented Apr 24, 2019 at 7:27

1 Answer 1

1

This is same as previously asked on stackoverflow. Please find the link

This is issue is like your awssdk.sqs dll version mismatch.

Sign up to request clarification or add additional context in comments.

2 Comments

Thank you for your comment. Unfortunately, my issue doesn't seem to be related to the article that you have mentioned. However, I am wondering whether I need to include the awssdk.sqs.dll in both class library and web project? if so, why? Shouldn't the web project retrieve the .dll from the class library? Because it doesn't make sense in including an SDK in both class library and the web project.
I don't know my understanding is correct or not, but you need to add the .dll in both library. That is needed as you can inject these different class library project independently. The second answer for you web project -> You no need to add this .dll in web project unless you used any functionality from this awssdk.sqs.dll.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.