Visual Studio Project dependencies

2019-02-25 09:43发布

I have a Visual Studio .Net Solution which has many projects/libraries.

When I work locally on my own PC there is no problem as I tend to recompile those libraries that I have just changed and everything is in sync.

The problem is sometimes other developers who once in a while require to work on or look at my code have an enormous problem recompiling everything.

In the configuration Manager, I do not have all projects checked else it would take too long to build everything whislt working.

Problem is when the solution is compiled on another application, some of the errors reported say a particular library has error and its taking too long to figure out all the dependencies compiling each one individually.

Even when checking everything in the config manager it still does not seem to compile correctly.

I thought when you add a reference to a library the dependencies are taken care of.

Is there a simple way to make sure the solution determines what are the correct dependencies and make sure everything is built in the correct order?

Thank you

2条回答
我命由我不由天
2楼-- · 2019-02-25 10:01

After other developers got new source codes from you, they should close Visual Studio and reopen the solution.

Sometimes there are also troubles with dependencies in Visual Studio. First, try these menu commands:

Build > Clean Solution
Build > Rebuild Solution

This will show you which dependencies are cyclic or not correct. Also, in Visual Studio project must not depend on another one which creates executable (at least for our pure C++ -written project this is true). I.e. "Utils" project which compiles into "Utils.dll" cannot depend on "MyApp" project, which exports some functions or symbols and compiles into both MyApp.exe and MyApp.lib (or some other kind of assembly). If you have such a dependency, you must correctly setup project build order and manually set MyApp.lib as in linker inputs.

查看更多
来,给爷笑一个
3楼-- · 2019-02-25 10:19

You can package and distribute your assemblies using http://nuget.codeplex.com/. It's made to solve this problem.

查看更多
登录 后发表回答