Assembly References in VS Solution Dependency Visualizer 0.93

February 15, 2014

One thing that always bugged (haha) me with VS Solution Dependency Visualizer was that it did not distinguish between different referenced assemblies in different locations.

For example, if a VS solution contains one C# project P1 that references a project “MyTools” (also part of that solution), but project P2 references an assembly “MyTools” (e.g. as binary, or as the output of said project), then VS Solution Dependency Visualizer would not distinguish these assemblies, and extract incorrect dependency information from the solution and its projects.

Well, this has now been fixed.

Version 0.93 will now distinguish assemblies, whether they are in the solution, in the file system, or in the GAC.

As a consequence, it is now possible to analyze the solution for

  • assemblies missing in the file system or in the GAC
  • duplicate assemblies (same name, different location)

and to list all assemblies referenced by the solution.

To check for GAC assemblies, it was necessary to create a .Net 4 build as well, as assemblies can only be loaded if their .Net version is lower or equal to the .Net version of the executable that loads them.

A minor UI fix, the solution folders and projects are now sorted alphabetically in the solution tree.

As usual, the latest release of VS Solution Dependency Viewer is available for download here.

Advertisements

List Invalid Guids of Referenced Projects in VS Solution Dependency Visualizer 0.92

October 19, 2012

While preparing one of my projects for production, I came across a “funny” error:

While Visual Studio builds a solution without errors, msbuild raised the following error for an ASP.Net web application:

The type or namespace name ‘foo.bar’ does not exist in the namespace ‘foo’ (are you missing an assembly reference?)

I checked in Solution Explorer, and the project reference was clearly there, the assembly showed the namespace in ILSpy, and VS built the solution.

A little panicky, I removed the project reference and added it again. msbuild was now able to build the web application, but the build process raised solution file warnings:

c:\path\to\solution.sln : Solution file warning MSB4051: Project {Some-GUID-0001} is referencing a project with GUID {Other-GUID-0002}, but a project with this GUID was not found in the .SLN file.

Notice that the error message does NOT inform us while project contains the reference, and which other project was meant to be referenced, even though VS has all the necessary information to display the projects.

So I started another instance of VS, opened the VSSlnDep project, and added a new function, “List Invalid Guids of Project References”.

This function iterates through the project references of each project file (*.csproj, *.vbproj), and checks whether the referenced Guid is the project Guid of any project in the solution. If not, the reference is displayed using the referring and the referred project file names, along with both Guids.

To solve the invalid Guids, you need to navigate to the referring project in Solution Explorer, delete the project reference and add it again.

Conclusion 1: Visual Studio seems to resolve references using the project file name, whereas msbuild resolves using the project Guids.

Conclusion 2: Nobody knows why VS changes project Guids. Not even Microsoft.

As usual, the latest release of VS Solution Dependency Viewer is available for download here.


List Shared Project Files in VS Solution Dependency Visualizer 0.91

October 14, 2012

A user of VS Solution Dependency Visualizer inherited a couple of copy-and-paste projects and asked whether it was possible to detect which files and directories are used by which projects.

As for directories, if you check the “Include Files” options, click “Analyze”, and switch to the “Analysis” tab, and invoke “List Directories” or “List Project Directories”,  VS Solution Dependency Visualizer displays all directories used by files in any project of the opened solution, either for the whole solution, or per project.

The updated version 0.91 also implements the options “List Files” and “List Project Files”, again displaying the list of files in the whole solution, or per project. (This List Files function was implemented in earlier versions as part of the display of a solution or project node in the tree view, but removed in the meantime)

I also added an analysis function “List Shared Project Files” which displays all files that are part of at least 2 projects in a solution (i.e. files that have been added using the “Add As Link” button).

In the tree view display of the Analysis tab, the names of the shared (or linked) files are displayed as root nodes, and the projects that contain them as child nodes.

As usual, the latest release of VS Solution Dependency Viewer is available for download here.


Support for VB.Net in VS Solution Dependency Visualizer 0.90

May 7, 2012

VS Solution Dependency Visualizer user janv8000 asked whether it would be possible to add analysis of VB.Net projects to vssdv. Until version 0.80, only C# projects were supported.

I had a look through the source code and was surprised that there were only a couple of places that caused the restriction to C#. After modifying teh codez to include VB.Net projects, I just needed a real-world VB.Net to test the new functionality. I knew that DNN changed from VB to C# in version 6, so I downloaded the source code of version 4 and 5 to run my tests.

Here are the results:

Resulting png’s show the dependency analysis of the DNN solutions from version 4 thru version 6, both with dependencies between source code projects, and dependencies on referenced project assemblies (without GAC assemblies).

Another issue that bugged me for quite some time now was the poor performance during dependency analysis. The root of the bug lay in a Linq statement which effectively caused a nested loop, and was resolved by replacing a .Where() condition by a Dictionary of respective types.

As usual, the latest release of VS Solution Dependency Viewer is available for download here.


VS Solution Dependency Visualizer maintenance release 0.80

April 9, 2012

The new version 0.80 of VS Solution Dependency Visualizer adds one more analysis function: extract all [assembly: ] attributes and values from C# files in all solution projects.

It also fixes a bug that may occur during the analysis of some .csproj project files.

As usual, the latest release of VS Solution Dependency Viewer is available for download here.


Analyzing Visual Studio Solutions

February 7, 2012

VS Solution Dependency Visualizer was originally started as a tool to generate dependency charts of projects and assemblies contained in a Visual Studio Solution (.sln) file.

As the program evolved, textual analysis features have been included: display lists of referencing and referenced projects and assemblies, list containing directories, etc.

The new version 0.70 of VS Solution Dependency Visualizer adds more analysis functions:

List Project Properties

displays Output Type, Assembly Name, Root Namespace, and Framework Version

List Namespaces


analyzes C# projects for namespace declarations

List Web URLs

extracts the URLs of Web Application projects

List Web Service URLs

extracts URLs of .asmx files and web service declarations from app.config.

Dependency Chart

The application’s user interface has been re-worked so that the dependency chart is now contained in a tab of the (single) main window.

Project Coupling

displays coupling metrics indicating stability and responsibility of included projects.

More screenshots can be viewed in the gallery. As usual, the latest release of VS Solution Dependency Viewer is available for download here.


Minor Update of VS Solution Dependency Visualizer

August 24, 2011

The latest version 0.60 of VS Solution Dependency Visualizer contains a couple of UI improvements.

The VS solution file (.sln) and C# project files (.csproj) are now parsed in a background thread which displays the current activity. So no more long operations blocking the application.

Another new feature is the “Reload Solution” button. This allows you to make changes to the solution in Visual Studio, and update the changes into VS Solution Dependency Visualizer. The selections made in the solution’s tree view survive the reload.

The (inappropriate) distinction between “GAC assemblies” and “System assemblies” has been dropped, as the difference between the two was originally the “Copy Local” attribute. (A future version will parse and display more detailed information about projects and assemblies and their relations)

The installer adds VS Solution Dependency Visualizer as an External Tool, but it still needs to be manually activated by the user.

As usual, the latest release of VS Solution Dependency Viewer is available for download here.