Visual Studio refuses to build project due to missing assembly reference that isn't missing

前端 未结 6 1368
庸人自扰
庸人自扰 2020-12-18 18:38

I\'m building a c# windows service and has added a couple of assembly references (to other projects of my own) to my project.

I get the following error when I build

相关标签:
6条回答
  • 2020-12-18 18:51

    I the same problem. Or at least the symptoms were same. My solution was located on a network drive. Moving the solution to my local drive solved the problem for me.

    The reason was apparently that Windows 10 didn't see the network drive as a trusted enough location. It worked fine until I managed to break my solution somehow. Visual studio apparently didn't have the required rights to perform needed the fixing operations.

    0 讨论(0)
  • 2020-12-18 18:56

    1.remove all references

    2.Build --> Clean solution

    3.Clean your project using this project as sometimes visual studio fails to clean everything neatly.

    0 讨论(0)
  • 2020-12-18 18:57

    In my case, target Framework of Assembly Project and the target Framework of the project where i want to use this assembly are different. Target framework of assembly project was 4.5 and target framework of my project was 4.0.

    When I have change the target framework of my project to the target framework of assembly project i.e. from 4.0 to 4.5 , it works fine.

    For change the Target Framework of project,

    Right Click the project -> Properties -> Application -> Target Framework

    This Target Framework is drop-down list, select your required Framework from this list.

    0 讨论(0)
  • 2020-12-18 18:59

    Another possible issue could be mismatch in targeted versions of .NET between the assemblies. I experienced the same symptoms and setting the same version of framework did the trick for me.

    0 讨论(0)
  • 2020-12-18 19:03

    I think you are missing a Nuget Library called: Bogus. You can install it from Nuget-Solution installer in visual studio. Just install it and also add using Bogus.DataSets; on your class file. Hopefully this will solve your issue.

    0 讨论(0)
  • 2020-12-18 19:09

    Reinstalling packages worked for me.

    From the Package Manager Console, run the the following command to reinstall all packages.

    update-package -reinstall

    You can target a single package with:

    update-package PACKAGE_NAME -reinstall

    0 讨论(0)
提交回复
热议问题