Rebuild Visual Studio Library Project Reference

我与影子孤独终老i 提交于 2020-01-04 05:24:08

问题


I have a Visual Studio 2010 solution that contains multiple projects. One of these projects is a library, which I have added a method to. Within visual studio I can navigate from the method call in my main project to the method in the library, but when I attempt to build/run the solution it gives me a "does not contain a definition for 'My_Method'". What am I doing wrong?


回答1:


It looks as if the library project isnt being rebuilt on each run, assuming that the project reference is correctly added (right click on references -> add reference -> select your library project)

You should make sure that your library is being rebuilt when you run.

To do so :

  • Right click on your Solution

  • Click on Configuration manager (approximative translation)

  • Make sure that the build is checked, if not, check if for the library project



回答2:


Seems you are not rebuilding the library project and/or you are referencing the output binary (dll) directly. To solve this you can do one of the following

  1. Make sure you rebuild the library project, and reference the updated binary/dll
  2. Reference the project directly if it's part of your solution, this way, every time you rebuild the dependent project, it will rebuild the library project. The drawback to this is, if you have too many projects, it will slow you (re)builds


来源:https://stackoverflow.com/questions/9826167/rebuild-visual-studio-library-project-reference

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