简体   繁体   中英

Sharing assemblies between projects in a solution

I have a solution that has a project that has a class that I'd like to share with another project in the same solution.

This class depends on a library that was pulled in from nuget.

Because the second project hasn't pulled this same library from nuget, the class execution fails (despite the second project depending on the first).

Up to this point, I've just been going and adding the same nuget packages to multiple projects.

This seems terribly unwieldy as when I need to update one project, I have to remember to update them all, or depend on tests, which seems like a great opportunity for bugs to slip through the cracks.

How can I go about sharing these dependencies between multiple projects in the same solution?

I create a sample solution based on your description, I found the dependencies nuget library could be found automatically in other projects that reference Class1 project. But if I set the Copy to Local property as false for the nuget library in Class1 project references, I will get an error message about could not find the dependencies when running other projects.

So please check the Copy to Local property for the nuget library in your Class1 project to confirm it is set as True.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM