简体   繁体   中英

Adding reference Project vs DLL

I have few projects in a solution. When adding reference we have two ways -

  1. Add project as reference
  2. Add DLL directly reference

Which should be preferred ?

If you add a project reference the dll you use will be updated automatically if you edit project files.

You add DLL directly when you are not working on DLL sources.

You should use the DLL reference if the dll itself isn't meant to change, like external assemblies, or selected stable releases of other projects (ie not not necessarily the most recent build).

You should use a project reference if you always want to use the latest build of the referenced project (and if you want to debug the referenced project).

Add it as a project reference. This will ensure you have the correct dll when you build your solution, Debug or Release.

Otherwise you would have to depend on a location of your dll and that would be either debug or release and perhaps not even the most recent one.

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