How to generate dependency graph by class only for one project? - visual-studio-2010

If I use:
Architecture -> Generate Dependency Graph -> By Class
it generates the graph for the entire solution.
Is there a way to cause VS to generate the dependency graph only for classes from a certain project?
I tried generating only for a certain project using Architecture Explorer -> Create a new graph document from all the selected nodes (with and without having ctrl pressed) but it only generates either classes with no connection between them or classes connected to namespaces.
Thanks for your help!

Try out Resharper 8 (http://www.jetbrains.com/resharper/) it has lot's of features regarding dependency graphs.

unloading the projects that you don't want included appears to work in VS2012.
try in VS2010?

Related

Transitive project references with build dependencies?

I have the following projects in my solution (the tree structure indicate which projects reference which other projects):
A (.NET Core Web API, C#)
B (.NET Standard class library, C#)
X (.NET 4.0 class library, VB)
Y (.NET 4.0 class library, VB)
Z (.NET 2.0 class library, VB)
The only projects that should be managed from this solution are A and B. B uses some methods from X (which comes from elsewhere in our company), while X depends on Y which again depends on Z. All references are project references. (In reality, the hierarchy below X is wider/deeper, but the above serves to get the point across.)
I don't want to have unnecessary projects in my solution (which slows things down). At the same time, I want to have VS compile all dependencies in the correct order. AFAIK, all necessary information exists in the csproj/vbproj files, so I don't see a technical reason why VS shouldn't be able to do this if I just add X to the solution. But I can only get it to work if I add the entire tree below X.
Is there any (sensible) way to set up compilation of all dependent projects without adding the entire project hierarchy to the solution, or is this the way it's supposed to work?

Generate UML Class Diagram for one project in solution

I want to ask How can I generate UML Class Diagram for only one project in solution ? When I generate by click Architecture -> Generate Dependency Diagram, I get diagram of solution, I have 8 projects in solution, so diagram looks terible.
I programming in c# and use VS 2010 Ulimate
Can I generate diagram only for some classes ? for example for classes in one folder ?
I don't know this tool but did you try to drag and drop manually the class you want to display into an empty class diagram ? It usually works.
If you have an MSDN subscription, you can install the Visual Studio 2010 Feature Pack 2, so that you can do this: How to: Create UML Class Diagrams from Code.

General Compilation Problems VS 2010

I'm running VS2010 Version 10.0.30319.1 RMTRel
I've noticed problems compiling VB.NET application. When I "rebuild" the solution it reports the build was successful. When I then click the run icon to begin debugging, then the compiler will report build errors(often related to referenced projects). I've confirmed all the projects are targeting the same framework and after an undeterministic number of times repeating the same steps, it will eventually compile. This seems consistent enough to me with other code bases to believe that it's a problem with VS. Anyone have any thoughts that might help improve my experience?
You should also check your configuration manager - probably some of projects are disabled for building in current build plan.
is this a rather large solution? If so, the order of build may be out of whack and the way to solve that is to set the build order of the projects to make sure all of the dependent projects are built first.
One common reason is circular references. You cannot do this in a pair of projects, but it can be done if you cobble together a long string of projects. The way to catch this is a dependency mapping tool with a visual representation of dependencies. You will see the items that refer back up to the top.

VS 2010 Layer Diagram Validation Error is Showing A Dependency That Doesn't Even Exist (AV0001)

I'm getting the following validation error on my layer diagram:
Error 65 AV0001 : Invalid Dependency : Weld.Interface.Core(Assembly) --> Weld.Interface(Namespace)
Layers: Application Framework Core, Application Framework | Dependencies: Namespace Reference D:\Projects\Windows Projects\Weld\Weld\ModelingProject1\Weld.layerdiagram 0 0 ModelingProject1
These 2 assemblies are set up as different layers and the assembly name represents the namespace starting point as well.
Weld.Interface.Core: This assembly and namespace does not have a reference to Weld.Interface and only references .NET Framework classes
Weld.Interface: This assembly and namespace does not have a reference to Weld.Interface.Core
There is no dependency between these two layers in the dependency diagram. I am confused why I am getting this error. No dependency in the project or code, and no dependency is even setup in the layer diagram.
Somehow the Validation logic in the layer diagram is seeing a non existent dependency and saying it is an error.
Any ideas what either I might have missed or what is causing this problem?
OK, I figured out what was going on with my situation and thought I'd pass it along here. It appears to be an issue of cached references to assemblies. When the modeling project was originally created, it was in its own solution, separate from the assemblies it's intending to model. As such, it required listing them within the Layer References for the Modeling project.
The project has since been incorporated into the overall solution, but I believe the project references originally declared when separate from the solution kept precedence and, ultimately, was referencing old code. I removed the assemblies from the Layer References of the Modeling project and everything was smooth sailing after that.

Is this the correct way to eliminate warning C4945 (symbol already imported from another assembly)?

I've got a .net solution (written in C++/CLI) which references some .dll projects as follows:
MainProject->ProjectA->ProbjectB
MainProject->ProjectB
Originally I'd referenced both ProjectA and ProjectB from MainProject which gave me the warnings as mentioned above.
I can remove the warnings by removing the reference to ProjectB from ProjectMain but it makes it less obvious that MainProject relies on ProjectB. Is this the right thing to do to get rid of the warnings?
Speaking in general terms, a system of dependencies can be depicted by a directed graph where each node is a software component and each edge is a dependency. In my opinion, the more simplification that can be done to the graph, the better.
Yeah that's fine.
If you have ReSharper, you can view the dependency graph by right-clicking ProjectMain --> Project Hierarchy.
I just want to describe, but not explain, following relevant behaviour.
project CSCommon in C#
project CS1 in C#, using CSCommon
project CPP1 in C++, using CSCommon
project CPPMain, using CPP1
If each project has its own output path, I recieve C4945.
If all projects have common outputh path, warning disappears.
I had the same problem as you. And I solved it exactly as you described it: remove the reference to 'Project B' (in your specific case).
That is the only way I know how to fix this error, short of disabling it.
No, removing the reference is probably not the correct way to handle it.
See https://stackoverflow.com/a/12423588/321013
Set Use Dependencies in Build=false for your references.
The point is, that you should have all references that the code in the project itself uses as direct references, but the setting Use Dependencies in Build=TRUE interferes with that, as it pulls in the transitive references also, generating conflicts if you also have direct references. (At least on my VS2005)

Resources