In the previous article I wrote a simple powershell script to find all of the potentially missing file references from my Visual Studio project files.

I realized, however, that the script has some performance issues. For a large solution, it takes quite a few seconds to get the work done. So, I thought it would be much better to write some kind of library for this job. The fact is, I do not want to write some external tools like desktop application. I want to keep it simple. Simple like… installing the additional modules by nuget. Oh yeah, so just type some fancy command in package manager console and let it be done.

Sounds perfect!

Powershell cmdlet

You can write your custom command extension for powershell, it is called “cmdlet”. So I wrote one to meet my requirements. This is not a place for a tutorial “How to create custom cmdlet” that’s why if you want to know about it here you go some some hints about creating and dubugging cmdlets.

VSpniff

Let’s focus on my tool. I called it VSpniff – shortcut from Visual Studio project not included files finder. You can download the tool from here. There is also an instruction how to get the tool work in your Visual Studio package manager console.

Finding missing files references

Ok. So how does this works? Let’s simply assume we have some excluded files in project

excluded files

They could be accidentally excluded by bad merge or something and we may not even know about it. After installing VSpniff you could use it to avoid such situations. Just type in the PM console

And here we go

missing files listed

All the missing files listed.

Configuration

Ok. Let assume we do not want to look for .png files in the Images folder ;]. To do that, just add a config.vspniff file to the Images directory.

Run the tool once again and here we go

missing files listed 2

Configuration file must have .vspniff extension.

There is a default configuration in the box (hard coded) to avoid the need of adding any configuration files. This default configuration looks like that

Ok. So what does it mean?

This is it. I hope you will enjoy using this tool and it helps you avoid many bugs.

Peace.