Monotouch: добавление DLL-ссылок в субпроекта
-
15-11-2019 - |
Вопрос
Как я ищу лучшую практику здесь.
У меня есть общий проект, который передается многими из моих приложений.Этот проект имеет Flurryanaylics и ATMHUD DLLS в качестве ссылок.
Если я также не ссылаю на эти DLL в основном проекте, приложения часто будут, но не всегда, не удаются в тесте от отладки к устройству.В отладке-симуляторе мне не нужно добавлять эти DLL в основной проект.
Итак, вопрос: я должен включить ссылки на DLL в основном проекте, что у меня все время есть в подпункте?
Решение
Whenever possible I use references to project files (csproj files) over references to assemblies (.dll). It makes a lot of things easier, like:
- code navigation (IDE);
- automatic build dependency (the source code you're reading is the one you're building, not something potentially out-of-sync);
- source-level debugging (even if you can have it without it, you're sure to be in-sync);
- (easier) switch between Debug|Release|... configurations;
- changing defines (or any project-level option);
E.g.
Solution1.sln
- Project1a.csproj
- MonoTouch.Dialog.csproj (link to ../Common/MonoTouch.Dialog.csproj)
Solution2.sln
- Project2a.csproj
- MonoTouch.Dialog.csproj (link to ../Common/MonoTouch.Dialog.csproj)
Common.sln
- MonoTouch.Dialog.csproj
Large solutions might suffer a bit from doing this (build performance, searching across files...). The larger they get the less likely everyone has to know about every part of it. So there's a diminished return on the advantages while the inconvenience grows with each project being added.
E.g. I would not want to have references to every framework assemblies inside Mono (but personally I could live with all the SDK assemblies of MonoTouch ;-)
Note: Working with assemblies references should not cause you random errors while debugging on device. If you can create such a test case please fill a bug report :-)