How to include dependencies in Setup and Deployment Project?

半城伤御伤魂 提交于 2019-12-01 03:41:55

问题


I have a solution that consists of 3 projects. I've created a deployment project it is only including the dependencies from one of the projects in my solution.

What I've done so far is in my Setup and Deployment project, I right-clicked "Application Folder" to Add --> Project Output. Next I selected my main project from a dropdown and selected "Primary Output". I clicked OK and that project's dependencies were successfully included in the deployment.

I tried to repeat the same process for the other DLLs in my solution, but it didn't include their dependencies.

How do I include all dependencies for each project?


回答1:


Please note that the dependencies detected by a Visual Studio setup project are more like suggestions. You shouldn't put too much trust in them since false positives are very common.

For a professional installer you should determine the correct dependencies yourself and add them in your project in the appropriate form. For example, some of the dependencies may be part of a runtime or framework which can be added as a prerequisite to your installer.

If you can't figure out what dependencies your application has, you can try using a dependency walker.




回答2:


VS Setup projects dependency walking capability is pretty strong and really is a great go-to place for direct dependency checking and product binary packaging. With build verbosity increased, it allows direct analysis of which version of each DLL is referenced so you have the info you need to update build references. Unfortunately, the version info is baked into the dependencies and the setup project may not pick things up if it doesn't find an appropriate version available in search paths.

With regards to false positives, my experience is it will bring in any binary reference regardless of whether there is an actual code path up that tree. A solution to that problem is to refactor your code (granularise the projects a bit better).

If you do not use direct project references, the setup projects won't bring in those dependencies. Is that the issue you are encountering? Otherwise, I'd turn up the log verbosity and search for the references you are expecting. It should say which version it is looking for and where it searched and why it didn't grab anything.



来源:https://stackoverflow.com/questions/11011088/how-to-include-dependencies-in-setup-and-deployment-project

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!