te')); return $arr; } /* 遍历用户所有主题 * @param $uid 用户ID * @param int $page 页数 * @param int $pagesize 每页记录条数 * @param bool $desc 排序方式 TRUE降序 FALSE升序 * @param string $key 返回的数组用那一列的值作为 key * @param array $col 查询哪些列 */ function thread_tid_find_by_uid($uid, $page = 1, $pagesize = 1000, $desc = TRUE, $key = 'tid', $col = array()) { if (empty($uid)) return array(); $orderby = TRUE == $desc ? -1 : 1; $arr = thread_tid__find($cond = array('uid' => $uid), array('tid' => $orderby), $page, $pagesize, $key, $col); return $arr; } // 遍历栏目下tid 支持数组 $fid = array(1,2,3) function thread_tid_find_by_fid($fid, $page = 1, $pagesize = 1000, $desc = TRUE) { if (empty($fid)) return array(); $orderby = TRUE == $desc ? -1 : 1; $arr = thread_tid__find($cond = array('fid' => $fid), array('tid' => $orderby), $page, $pagesize, 'tid', array('tid', 'verify_date')); return $arr; } function thread_tid_delete($tid) { if (empty($tid)) return FALSE; $r = thread_tid__delete(array('tid' => $tid)); return $r; } function thread_tid_count() { $n = thread_tid__count(); return $n; } // 统计用户主题数 大数量下严谨使用非主键统计 function thread_uid_count($uid) { $n = thread_tid__count(array('uid' => $uid)); return $n; } // 统计栏目主题数 大数量下严谨使用非主键统计 function thread_fid_count($fid) { $n = thread_tid__count(array('fid' => $fid)); return $n; } ?>c# - How to correctly include a created DLL, which includes other DLLs, in a project? - Stack Overflow
最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

c# - How to correctly include a created DLL, which includes other DLLs, in a project? - Stack Overflow

programmeradmin4浏览0评论

I have somes difficulties to include the dll that I am creating to a project.

Here is the situation :

  • A.dll (My dll) works with B.dll & C.dll (whose come from NuGet)
  • ProjectWPF

I put the A.dll (from the bin/Release) of the A.dll project, to the ProjectWPF root folder. Then I add new reference to the copyied dll.

When doing that, the execution fails, saying that some dlls are missing (B & C dll). The thing is that it only works when I am installing B & D dll from the NuGet in the ProjectWPF. And, of course, I don't want to do that each time I am including A.dll to a project.

I think that there must be a way to simply include a dll (which works with other dlls), by simply adding THAT dll, and not also the other.

Hope you understand my problem. Thank, and waiting for your help.

LocalCopy is already true on the reference

I have somes difficulties to include the dll that I am creating to a project.

Here is the situation :

  • A.dll (My dll) works with B.dll & C.dll (whose come from NuGet)
  • ProjectWPF

I put the A.dll (from the bin/Release) of the A.dll project, to the ProjectWPF root folder. Then I add new reference to the copyied dll.

When doing that, the execution fails, saying that some dlls are missing (B & C dll). The thing is that it only works when I am installing B & D dll from the NuGet in the ProjectWPF. And, of course, I don't want to do that each time I am including A.dll to a project.

I think that there must be a way to simply include a dll (which works with other dlls), by simply adding THAT dll, and not also the other.

Hope you understand my problem. Thank, and waiting for your help.

LocalCopy is already true on the reference

Share Improve this question edited 2 days ago ASh 35.7k9 gold badges65 silver badges87 bronze badges asked 2 days ago mr_noisettemr_noisette 34 bronze badges New contributor mr_noisette is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct. 4
  • 1 "How to correctly include a created DLL, which includes other DLLs, in a project?" - you don't. You use NuGets. As you already do. Now in your WPF Project, you can have a ProjectReference or you can yourself choose to create your own nuget. Mind that there is the possibility to also create "private" nugets and -sources. (Private to your company/Orga or even Project) – Fildor Commented 2 days ago
  • 3 You shouldn't "put" dlls yourself, rather reference class library in solution and setup its depedencies, the rest (copying dlls into output folder) will be done automatically by publishing. – Sinatr Commented 2 days ago
  • See also: Manage references in a project <- If you do it correctly, as Sinatr says, you shouldn't need to copy around dlls manually and explicitly at all. – Fildor Commented 2 days ago
  • You can't imagine how the "ProjectReference" solved my problem... A huge thank to both of you! – mr_noisette Commented 2 days ago
Add a comment  | 

1 Answer 1

Reset to default 2

I mostly use 3 ways to add references. All are available as context menu options to the "dependencies" node for your project in the solution explorer:

Project references

Put Project A and ProjectWPF in the same solution, and add a project reference from ProjectWPF to Project A. This should automatically include all transitive dependencies.

Nuget references

If Project A for some reason need to be in another solution/repository you can still deploy it from a local nuget server. This require a bit of work to setup such a server, and likely a continuous integration server to build and deploy the packages. But it is feasible for even fairly small companies. You also need to add your nuget server as a package source in visual studio.

It is also possible to use a simple folder as a package destination/source. But I would not expect this to work well if you have more than a few packages.

This method should also include all transitive dependencies, but I have found it not quite as reliable as project references.

Assembly references

This is mostly useful for third party dlls that rarely change. Add the dll, and all of its dependencies, to a folder as part of your repository, and add Assembly references to each. For native dlls you can add them as simple content files with the "copy to output directory" property. Note that this makes updates a pain, so is more of a last resort option.

With this option you need to manage any transitive dependencies yourself.

与本文相关的文章

发布评论

评论列表(0)

  1. 暂无评论